mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
miner: removed unnecessary state.Copy()
This commit is contained in:
parent
801a13f791
commit
8cd7bbcf2d
2 changed files with 20 additions and 0 deletions
|
|
@ -187,6 +187,11 @@ func (self *Miner) Pending() (*types.Block, *state.StateDB) {
|
||||||
return self.worker.pending()
|
return self.worker.pending()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PendingBlock returns the currently pending block.
|
||||||
|
func (self *Miner) PendingBlock() *types.Block {
|
||||||
|
return self.worker.pendingBlock()
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Miner) SetEtherbase(addr common.Address) {
|
func (self *Miner) SetEtherbase(addr common.Address) {
|
||||||
self.coinbase = addr
|
self.coinbase = addr
|
||||||
self.worker.setEtherbase(addr)
|
self.worker.setEtherbase(addr)
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,21 @@ func (self *worker) pending() (*types.Block, *state.StateDB) {
|
||||||
return self.current.Block, self.current.state.Copy()
|
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() {
|
func (self *worker) start() {
|
||||||
self.mu.Lock()
|
self.mu.Lock()
|
||||||
defer self.mu.Unlock()
|
defer self.mu.Unlock()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue