From 2726509176ced52c82a8085f6635d0b24e43272c Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Thu, 20 Nov 2025 15:53:21 +0800 Subject: [PATCH] core: using the cached prev for comparisons, fix XFN-96 --- core/blockchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/blockchain.go b/core/blockchain.go index cb4bcc56ce..36187dcf86 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1585,7 +1585,7 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (int, error) { // Do a sanity check that the provided chain is actually ordered and linked for i := 1; i < len(chain); i++ { block, prev := chain[i], chain[i-1] - if block.NumberU64() != chain[i-1].NumberU64()+1 || block.ParentHash() != chain[i-1].Hash() { + if block.NumberU64() != prev.NumberU64()+1 || block.ParentHash() != prev.Hash() { // Chain broke ancestry, log a messge (programming error) and skip insertion log.Error("Non contiguous block insert", "number", block.Number(),