diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-06-29 21:17:05 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-06-30 00:51:49 +0800 |
commit | ac80ec59dc223c679639aaae9a42325e18cde9c8 (patch) | |
tree | 87f1dca8d5eb016ed4d310f0e8b36a716a9c466a | |
parent | e349fac97dea92ef77ba5e72599fbe9f0ae16c2a (diff) | |
download | go-tangerine-ac80ec59dc223c679639aaae9a42325e18cde9c8.tar go-tangerine-ac80ec59dc223c679639aaae9a42325e18cde9c8.tar.gz go-tangerine-ac80ec59dc223c679639aaae9a42325e18cde9c8.tar.bz2 go-tangerine-ac80ec59dc223c679639aaae9a42325e18cde9c8.tar.lz go-tangerine-ac80ec59dc223c679639aaae9a42325e18cde9c8.tar.xz go-tangerine-ac80ec59dc223c679639aaae9a42325e18cde9c8.tar.zst go-tangerine-ac80ec59dc223c679639aaae9a42325e18cde9c8.zip |
miner: update root only when mining
-rw-r--r-- | miner/worker.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/miner/worker.go b/miner/worker.go index 3a2d7a41b..bc2fe1ab2 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -416,10 +416,12 @@ func (self *worker) commitNewWork() { delete(self.possibleUncles, hash) } - // commit state root after all state transitions. - core.AccumulateRewards(self.current.state, header, uncles) - current.state.Update() - header.Root = current.state.Root() + if atomic.LoadInt32(&self.mining) == 1 { + // commit state root after all state transitions. + core.AccumulateRewards(self.current.state, header, uncles) + current.state.Update() + header.Root = current.state.Root() + } // create the new block whose nonce will be mined. current.block = types.NewBlock(header, current.txs, uncles, current.receipts) |