mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
core: using the cached prev for comparisons, fix XFN-96
This commit is contained in:
parent
0ed20eface
commit
2726509176
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
// Do a sanity check that the provided chain is actually ordered and linked
|
||||||
for i := 1; i < len(chain); i++ {
|
for i := 1; i < len(chain); i++ {
|
||||||
block, prev := chain[i], chain[i-1]
|
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
|
// Chain broke ancestry, log a messge (programming error) and skip insertion
|
||||||
log.Error("Non contiguous block insert",
|
log.Error("Non contiguous block insert",
|
||||||
"number", block.Number(),
|
"number", block.Number(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue