core: fix crash in chain reimport (#19986)
* blockchain: fix flaw in block import * core/blockchain: address review concerns * core/blockchain: go format with 's'
This commit is contained in:
committed by
Péter Szilágyi
parent
039a9c3622
commit
4aee0d1994
@ -1742,6 +1742,11 @@ func (bc *BlockChain) insertSideChain(block *types.Block, it *insertIterator) (i
|
||||
canonical := bc.GetBlockByNumber(number)
|
||||
if canonical != nil && canonical.Hash() == block.Hash() {
|
||||
// Not a sidechain block, this is a re-import of a canon block which has it's state pruned
|
||||
|
||||
// Collect the TD of the block. Since we know it's a canon one,
|
||||
// we can get it directly, and not (like further below) use
|
||||
// the parent and then add the block on top
|
||||
externTd = bc.GetTd(block.Hash(), block.NumberU64())
|
||||
continue
|
||||
}
|
||||
if canonical != nil && canonical.Root() == block.Root() {
|
||||
|
Reference in New Issue
Block a user