aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-08-14 23:34:33 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-14 23:34:33 +0800
commita1783d169732dd34aa8c7d68f411ce741c1a5015 (patch)
tree14e12ac6077667789c0fe5bd1166fdc534528d73 /core
parente0e0e53401e93733d921338b6d794162c40a7883 (diff)
downloadgo-tangerine-a1783d169732dd34aa8c7d68f411ce741c1a5015.tar
go-tangerine-a1783d169732dd34aa8c7d68f411ce741c1a5015.tar.gz
go-tangerine-a1783d169732dd34aa8c7d68f411ce741c1a5015.tar.bz2
go-tangerine-a1783d169732dd34aa8c7d68f411ce741c1a5015.tar.lz
go-tangerine-a1783d169732dd34aa8c7d68f411ce741c1a5015.tar.xz
go-tangerine-a1783d169732dd34aa8c7d68f411ce741c1a5015.tar.zst
go-tangerine-a1783d169732dd34aa8c7d68f411ce741c1a5015.zip
miner: move agent logic to worker (#17351)
* miner: move agent logic to worker * miner: polish * core: persist block before reorg
Diffstat (limited to 'core')
-rw-r--r--core/blockchain.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 62dc26125..0461da7fd 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -899,9 +899,7 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
if err := bc.hc.WriteTd(block.Hash(), block.NumberU64(), externTd); err != nil {
return NonStatTy, err
}
- // Write other block data using a batch.
- batch := bc.db.NewBatch()
- rawdb.WriteBlock(batch, block)
+ rawdb.WriteBlock(bc.db, block)
root, err := state.Commit(bc.chainConfig.IsEIP158(block.Number()))
if err != nil {
@@ -955,6 +953,9 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
}
}
}
+
+ // Write other block data using a batch.
+ batch := bc.db.NewBatch()
rawdb.WriteReceipts(batch, block.Hash(), block.NumberU64(), receipts)
// If the total difficulty is higher than our known, add it to the canonical chain