From 3051b2de41792e60526a5d30b8daedd33bd46c4d Mon Sep 17 00:00:00 2001 From: Banana-J Date: Sun, 10 Mar 2024 09:51:05 +1100 Subject: [PATCH] use rlock instead of lock in v1 consensus engine (#483) Co-authored-by: wjrjerome --- consensus/XDPoS/engines/engine_v1/engine.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consensus/XDPoS/engines/engine_v1/engine.go b/consensus/XDPoS/engines/engine_v1/engine.go index b647f43055..7fce2e6a86 100644 --- a/consensus/XDPoS/engines/engine_v1/engine.go +++ b/consensus/XDPoS/engines/engine_v1/engine.go @@ -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) }