aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2019-10-21 16:07:47 -0400
committerDeterminant <ted.sybil@gmail.com>2019-10-21 16:07:47 -0400
commit7212dbd90f4cb8fe907617f804c8940db1ce657e (patch)
treea80485085a7c30e2bb06cc64081a1effcffd2204 /core
parent79b1169a9ff0b54ddf3b520a70a79c78ba5c988d (diff)
fix the pool reset bug
Diffstat (limited to 'core')
-rw-r--r--core/blockchain.go28
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