mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
core: remove unnecessary nil check and add cv2 lock
This commit is contained in:
parent
59405c40d3
commit
8954cbf58f
1 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue