From 8954cbf58f33b5a356b495f74caf4c8006744c3e Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Thu, 31 Jul 2025 13:30:48 +0800 Subject: [PATCH] core: remove unnecessary nil check and add cv2 lock --- core/filtermaps/chain_view.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/filtermaps/chain_view.go b/core/filtermaps/chain_view.go index 7c48048ad9..9ede3afd87 100644 --- a/core/filtermaps/chain_view.go +++ b/core/filtermaps/chain_view.go @@ -124,10 +124,16 @@ func (cv *ChainView) RawReceipts(number uint64) types.Receipts { // SharedRange returns the block range shared by two chain views. func (cv *ChainView) SharedRange(cv2 *ChainView) common.Range[uint64] { + if cv2 == nil { + return common.Range[uint64]{} + } + cv.lock.Lock() defer cv.lock.Unlock() + cv2.lock.Lock() + defer cv2.lock.Unlock() - if cv == nil || cv2 == nil || !cv.extendNonCanonical() || !cv2.extendNonCanonical() { + if !cv.extendNonCanonical() || !cv2.extendNonCanonical() { return common.Range[uint64]{} } var sharedLen uint64