Skip to content

Commit

Permalink
miner: update root only when mining
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed Jun 29, 2015
1 parent e349fac commit ac80ec5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ac80ec5

Please sign in to comment.