diff options
author | Martin Holst Swende <martin@swende.se> | 2016-11-30 17:48:48 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-11-30 17:48:48 +0800 |
commit | 9f8bc00cf56bdf2cabf060303ed69f277a03357a (patch) | |
tree | 1d3e13d602c3ae2a0106fef23cc620aba4962f2c /miner/worker.go | |
parent | 3363a1c2277ccd3aee9e05850accd8c50e016bfa (diff) | |
download | go-tangerine-9f8bc00cf56bdf2cabf060303ed69f277a03357a.tar go-tangerine-9f8bc00cf56bdf2cabf060303ed69f277a03357a.tar.gz go-tangerine-9f8bc00cf56bdf2cabf060303ed69f277a03357a.tar.bz2 go-tangerine-9f8bc00cf56bdf2cabf060303ed69f277a03357a.tar.lz go-tangerine-9f8bc00cf56bdf2cabf060303ed69f277a03357a.tar.xz go-tangerine-9f8bc00cf56bdf2cabf060303ed69f277a03357a.tar.zst go-tangerine-9f8bc00cf56bdf2cabf060303ed69f277a03357a.zip |
eth, miner: removed unnecessary state.Copy()
* miner: removed unnecessary state.Copy()
* eth: made use of new miner method without state copying
* miner: More documentation about new method
Diffstat (limited to 'miner/worker.go')
-rw-r--r-- | miner/worker.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/miner/worker.go b/miner/worker.go index ca00c7229..edbd502c1 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -176,6 +176,21 @@ func (self *worker) pending() (*types.Block, *state.StateDB) { return self.current.Block, self.current.state.Copy() } +func (self *worker) pendingBlock() *types.Block { + self.currentMu.Lock() + defer self.currentMu.Unlock() + + if atomic.LoadInt32(&self.mining) == 0 { + return types.NewBlock( + self.current.header, + self.current.txs, + nil, + self.current.receipts, + ) + } + return self.current.Block +} + func (self *worker) start() { self.mu.Lock() defer self.mu.Unlock() |