Summary
Block parent continuity check compares against the wrong value in Blockchain.Run.
In the incoming block path, the code currently does:
if reflect.DeepEqual(b.PrevBlock, bl.CurrentBlock.Hash()) {
fmt.Println("Missing blocks in between")
} else {
// accept/add block
}
b.PrevBlock should point to the previous confirmed block hash, but bl.CurrentBlock.Hash() is the hash of the current candidate block template (not the expected parent hash). This makes the continuity check unreliable and can accept out-of-sequence blocks.
Location
core/blockchain.go (inside func (bl *Blockchain) Run())
Expected behavior
Compare b.PrevBlock to the expected parent hash for the current mining context (e.g. bl.CurrentBlock.PrevBlock) before accepting the block.
Why this matters
Chain continuity validation is a critical consensus safety check. Comparing to the candidate block hash instead of candidate parent hash can allow invalid chain progression logic.
Summary
Block parent continuity check compares against the wrong value in
Blockchain.Run.In the incoming block path, the code currently does:
b.PrevBlockshould point to the previous confirmed block hash, butbl.CurrentBlock.Hash()is the hash of the current candidate block template (not the expected parent hash). This makes the continuity check unreliable and can accept out-of-sequence blocks.Location
core/blockchain.go(insidefunc (bl *Blockchain) Run())Expected behavior
Compare
b.PrevBlockto the expected parent hash for the current mining context (e.g.bl.CurrentBlock.PrevBlock) before accepting the block.Why this matters
Chain continuity validation is a critical consensus safety check. Comparing to the candidate block hash instead of candidate parent hash can allow invalid chain progression logic.