From 047197e24c05438cc07f5b3928a680b7d6ba6a7f Mon Sep 17 00:00:00 2001 From: Mark Holt <135143369+mh0lt@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:17:55 +0100 Subject: [PATCH] Fix panic in isAgra check for txpool (#8562) Fixes a nil pointer panic in the isagra check when running on an empty chain db. In this case the block will return as nil with no error. --- erigon-lib/txpool/pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erigon-lib/txpool/pool.go b/erigon-lib/txpool/pool.go index 528c8425c..9111b5f4b 100644 --- a/erigon-lib/txpool/pool.go +++ b/erigon-lib/txpool/pool.go @@ -915,7 +915,7 @@ func (p *TxPool) isAgra() bool { defer tx.Rollback() head_block, err := chain.CurrentBlockNumber(tx) - if err != nil { + if head_block == nil || err != nil { return false } // A new block is built on top of the head block, so when the head is agraBlock-1,