From 72f23710bad951958d81e09e400ed79c3b63e69c Mon Sep 17 00:00:00 2001 From: maskpp Date: Fri, 28 Jun 2024 21:18:52 +0800 Subject: [PATCH] simplify Pop function in nonceHeap --- core/txpool/legacypool/list.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/txpool/legacypool/list.go b/core/txpool/legacypool/list.go index b749db44d4..147cffc2a5 100644 --- a/core/txpool/legacypool/list.go +++ b/core/txpool/legacypool/list.go @@ -44,11 +44,8 @@ func (h *nonceHeap) Push(x interface{}) { } func (h *nonceHeap) Pop() interface{} { - old := *h - n := len(old) - x := old[n-1] - old[n-1] = 0 - *h = old[0 : n-1] + var x interface{} + x, *h = (*h)[len(*h)-1], (*h)[:len(*h)-1] return x }