Skip to content

Commit

Permalink
use rlock instead of lock in v1 consensus engine
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwbabylonlab committed Mar 9, 2024
1 parent 910d415 commit 741dd40
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 741dd40

Please sign in to comment.