From f826f36d66674b23a318385dc4efa772c9f3a55e Mon Sep 17 00:00:00 2001 From: j75689 Date: Thu, 29 Jul 2021 13:28:55 +0800 Subject: [PATCH] fix: nil pointer --- eth/fetcher/block_fetcher.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eth/fetcher/block_fetcher.go b/eth/fetcher/block_fetcher.go index 1c2b6d6bed..47f649082c 100644 --- a/eth/fetcher/block_fetcher.go +++ b/eth/fetcher/block_fetcher.go @@ -422,7 +422,17 @@ func (f *BlockFetcher) loop() { case op := <-f.requeue: // Re-queue blocks that have not been written due to fork block competition - log.Info("Re-queue blocks", "number", op.header.Number.Int64(), "hash", op.header.Hash().String()) + number := int64(0) + hash := "" + if op.header != nil { + number = op.header.Number.Int64() + hash = op.header.Hash().String() + } else if op.block != nil { + number = op.block.Number().Int64() + hash = op.block.Hash().String() + } + + log.Info("Re-queue blocks", "number", number, "hash", hash) f.enqueue(op.origin, op.header, op.block) case op := <-f.inject: