Skip to content

Commit

Permalink
fix nil headblock
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduard-Voiculescu committed Mar 13, 2024
1 parent 2616ff1 commit 8bde96e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fetch/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 8bde96e

Please sign in to comment.