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.
This commit is contained in:
Mark Holt 2023-10-23 15:17:55 +01:00 committed by GitHub
parent a54939633e
commit 047197e24c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -915,7 +915,7 @@ func (p *TxPool) isAgra() bool {
defer tx.Rollback() defer tx.Rollback()
head_block, err := chain.CurrentBlockNumber(tx) head_block, err := chain.CurrentBlockNumber(tx)
if err != nil { if head_block == nil || err != nil {
return false return false
} }
// A new block is built on top of the head block, so when the head is agraBlock-1, // A new block is built on top of the head block, so when the head is agraBlock-1,