mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
use rlock instead of lock in v1 consensus engine (#483)
Co-authored-by: wjrjerome <wjrjerome@babylonchain.io>
This commit is contained in:
parent
c7cb63dd09
commit
3051b2de41
1 changed files with 2 additions and 2 deletions
|
|
@ -958,9 +958,9 @@ func (x *XDPoS_v1) Seal(chain consensus.ChainReader, block *types.Block, stop <-
|
||||||
// that a new block should have based on the previous blocks in the chain and the
|
// that a new block should have based on the previous blocks in the chain and the
|
||||||
// current signer.
|
// current signer.
|
||||||
func (x *XDPoS_v1) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int {
|
func (x *XDPoS_v1) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int {
|
||||||
x.lock.Lock()
|
x.lock.RLock()
|
||||||
signer := x.signer
|
signer := x.signer
|
||||||
x.lock.Unlock()
|
x.lock.RUnlock()
|
||||||
return x.calcDifficulty(chain, parent, signer)
|
return x.calcDifficulty(chain, parent, signer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue