From 347362b4e7fd36f038f9a5ad92d6fb0bcd40bf33 Mon Sep 17 00:00:00 2001 From: Danyal Prout Date: Wed, 13 Mar 2024 11:01:12 -0500 Subject: [PATCH] Log backfill complete when hit genesis block --- archiver/service/archiver.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/archiver/service/archiver.go b/archiver/service/archiver.go index fcdbc98..caf7f0f 100644 --- a/archiver/service/archiver.go +++ b/archiver/service/archiver.go @@ -137,13 +137,18 @@ func (a *Archiver) persistBlobsForBlockToS3(ctx context.Context, blockIdentifier func (a *Archiver) backfillBlobs(ctx context.Context, latest *v1.BeaconBlockHeader) { current, alreadyExists, err := latest, false, error(nil) + defer func() { + a.log.Info("backfill complete", "endHash", current.Root.String(), "startHash", latest.Root.String()) + }() + for !alreadyExists { + previous := current + if common.Hash(current.Root) == a.cfg.OriginBlock { a.log.Info("reached origin block", "hash", current.Root.String()) return } - previous := current current, alreadyExists, err = a.persistBlobsForBlockToS3(ctx, previous.Header.Message.ParentRoot.String(), false) if err != nil { a.log.Error("failed to persist blobs for block, will retry", "err", err, "hash", previous.Header.Message.ParentRoot.String()) @@ -157,8 +162,6 @@ func (a *Archiver) backfillBlobs(ctx context.Context, latest *v1.BeaconBlockHead a.metrics.RecordProcessedBlock(metrics.BlockSourceBackfill) } } - - a.log.Info("backfill complete", "endHash", current.Root.String(), "startHash", latest.Root.String()) } // trackLatestBlocks will poll the beacon node for the latest blocks and persist blobs for them.