diff options
author | Determinant <[email protected]> | 2019-10-21 16:07:47 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-10-21 16:07:47 -0400 |
commit | 7212dbd90f4cb8fe907617f804c8940db1ce657e (patch) | |
tree | a80485085a7c30e2bb06cc64081a1effcffd2204 /core | |
parent | 79b1169a9ff0b54ddf3b520a70a79c78ba5c988d (diff) |
fix the pool reset bug
Diffstat (limited to 'core')
-rw-r--r-- | core/blockchain.go | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 174d403..046e1d4 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1369,20 +1369,24 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. reorg = !currentPreserve && (blockPreserve || mrand.Float64() < 0.5) } } - if !bc.manualCanonical && reorg { - // Reorganise the chain if the parent is not the head block - if block.ParentHash() != currentBlock.Hash() { - if err := bc.reorg(currentBlock, block); err != nil { - return NonStatTy, err - } - } - // Write the positional metadata for transaction/receipt lookups and preimages - rawdb.WriteTxLookupEntries(batch, block) - rawdb.WritePreimages(batch, state.Preimages()) - + if bc.manualCanonical { status = CanonStatTy } else { - status = SideStatTy + if reorg { + // Reorganise the chain if the parent is not the head block + if block.ParentHash() != currentBlock.Hash() { + if err := bc.reorg(currentBlock, block); err != nil { + return NonStatTy, err + } + } + // Write the positional metadata for transaction/receipt lookups and preimages + rawdb.WriteTxLookupEntries(batch, block) + rawdb.WritePreimages(batch, state.Preimages()) + + status = CanonStatTy + } else { + status = SideStatTy + } } if err := batch.Write(); err != nil { return NonStatTy, err |