Skip to content

Commit

Permalink
use rlock instead of lock in v1 consensus engine (#483)
Browse files Browse the repository at this point in the history
Co-authored-by: wjrjerome <wjrjerome@babylonchain.io>
  • Loading branch information
wjrjerome and jrwbabylonlab authored Mar 9, 2024
1 parent c7cb63d commit 3051b2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions consensus/XDPoS/engines/engine_v1/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// current signer.
func (x *XDPoS_v1) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int {
x.lock.Lock()
x.lock.RLock()
signer := x.signer
x.lock.Unlock()
x.lock.RUnlock()
return x.calcDifficulty(chain, parent, signer)
}

Expand Down

0 comments on commit 3051b2d

Please sign in to comment.