From 8bde96ed22fcfc5a23a7bd5228d5be120213cc90 Mon Sep 17 00:00:00 2001 From: Eduard Voiculescu Date: Wed, 13 Mar 2024 13:31:15 -0400 Subject: [PATCH] fix nil headblock --- fetch/poller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch/poller.go b/fetch/poller.go index e87eaa5..78422b1 100644 --- a/fetch/poller.go +++ b/fetch/poller.go @@ -140,12 +140,12 @@ func (p *BlockFetcher) IsBlockAvailable(requestedSlot uint64) bool { func (p *BlockFetcher) Fetch(_ context.Context, blkNum uint64) (*pbbstream.Block, bool, error) { for p.headBlock.Num() < blkNum { - var err error - p.headBlock, err = p.GetHeadBlock() + headblock, err := p.GetHeadBlock() if err != nil { return nil, false, fmt.Errorf("failed to get head block: %w", err) } + p.headBlock = headblock if p.headBlock.Num() < blkNum { p.logger.Info("head block is behind, waiting for it to catch up", zap.Stringer("head_block", p.headBlock),