aboutsummaryrefslogtreecommitdiffstats
path: root/miner
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-08-18 20:14:45 +0800
committerFelix Lange <fjl@twurst.com>2015-09-23 04:57:37 +0800
commita2d5a60418e70ce56112381dffdd121cc678a1b6 (patch)
treec9733cb16b7ca5bac98d6ae11254def5a48aafb8 /miner
parent565d9f2306d19f63be6a6e1b8fc480af8dca9617 (diff)
downloadgo-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar
go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.gz
go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.bz2
go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.lz
go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.xz
go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.zst
go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.zip
core, core/state: batch-based state sync
Diffstat (limited to 'miner')
-rw-r--r--miner/worker.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/miner/worker.go b/miner/worker.go
index 22d0b9b6e..098f42a72 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -266,7 +266,6 @@ func (self *worker) wait() {
block := result.Block
work := result.Work
- work.state.Sync()
if self.fullValidation {
if _, err := self.chain.InsertChain(types.Blocks{block}); err != nil {
glog.V(logger.Error).Infoln("mining err", err)
@@ -274,6 +273,7 @@ func (self *worker) wait() {
}
go self.mux.Post(core.NewMinedBlockEvent{block})
} else {
+ work.state.Commit()
parent := self.chain.GetBlock(block.ParentHash())
if parent == nil {
glog.V(logger.Error).Infoln("Invalid block found during mining")
@@ -528,8 +528,7 @@ func (self *worker) commitNewWork() {
if atomic.LoadInt32(&self.mining) == 1 {
// commit state root after all state transitions.
core.AccumulateRewards(work.state, header, uncles)
- work.state.SyncObjects()
- header.Root = work.state.Root()
+ header.Root = work.state.IntermediateRoot()
}
// create the new block whose nonce will be mined.