From f0fdb5dfb215bebc54d2a62e54f0c7ae3e71ff91 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 21 Oct 2019 17:34:00 -0400 Subject: ... --- core/blockchain.go | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'core/blockchain.go') 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 -- cgit v1.2.3