aboutsummaryrefslogtreecommitdiff
path: root/core/blockchain.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/blockchain.go')
-rw-r--r--core/blockchain.go30
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