mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
miner: add mutex to protect the pending block
This commit is contained in:
parent
0115bb7bcf
commit
a81a19296f
1 changed files with 1 additions and 2 deletions
|
|
@ -139,11 +139,10 @@ func (miner *Miner) getPending() *newPayloadResult {
|
|||
|
||||
header := miner.chain.CurrentHeader()
|
||||
miner.pendingMu.Lock()
|
||||
defer miner.pendingMu.Unlock()
|
||||
if cached := miner.pending.resolve(header.Hash(), coinbase); cached != nil {
|
||||
miner.pendingMu.Unlock()
|
||||
return cached
|
||||
}
|
||||
defer miner.pendingMu.Unlock()
|
||||
|
||||
var (
|
||||
timestamp = uint64(time.Now().Unix())
|
||||
|
|
|
|||
Loading…
Reference in a new issue