diff options
author | Determinant <[email protected]> | 2019-10-21 17:34:00 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-10-21 17:34:00 -0400 |
commit | f0fdb5dfb215bebc54d2a62e54f0c7ae3e71ff91 (patch) | |
tree | d435d2b2e0ca3e8b6255c3b12b49e8a9ac7f0575 /core/blockchain.go | |
parent | 190b04fcbcadf4807c5c2bb0ef9e528bbff62e32 (diff) |
...
Diffstat (limited to 'core/blockchain.go')
-rw-r--r-- | core/blockchain.go | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 046e1d4..dddca62 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -825,7 +825,6 @@ func (bc *BlockChain) Stop() { for _, offset := range []uint64{0, 1, TriesInMemory - 1} { if number := bc.CurrentBlock().NumberU64(); number > offset { - log.Info(".....", "number", number, "offset", offset) recent := bc.GetBlockByNumber(number - offset) log.Info("Writing cached state to disk", "block", recent.Number(), "hash", recent.Hash(), "root", recent.Root()) @@ -1356,7 +1355,6 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. reorg := externTd.Cmp(localTd) > 0 currentBlock = bc.CurrentBlock() if !bc.manualCanonical && (!reorg && externTd.Cmp(localTd) == 0) { - //if (!reorg && externTd.Cmp(localTd) == 0) { // Split same-difficulty blocks by number, then preferentially select // the block generated by the local miner as the canonical block. if block.NumberU64() < currentBlock.NumberU64() { @@ -1369,24 +1367,20 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. reorg = !currentPreserve && (blockPreserve || mrand.Float64() < 0.5) } } - if bc.manualCanonical { - status = CanonStatTy - } else { - 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 - } + if reorg { + // Reorganise the chain if the parent is not the head block + if !bc.manualCanonical && 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 } + // 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 |