Skip to content

Commit 12a6af4

Browse files
committed
core/txpool: fix pendingset empty-check
1 parent bd7a7a8 commit 12a6af4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

core/txpool/pending.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (ps *pendingSet) Clear() {
137137
}
138138

139139
func (ps *pendingSet) Empty() bool {
140-
return len(ps.Heads) != 0
140+
return len(ps.Heads) == 0
141141
}
142142

143143
// Pop removes the best transaction, *not* replacing it with the next one from

core/txpool/pending_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ func TestPendingSortAndShift(t *testing.T) {
7373
haveCount = 0
7474
prevFee = uint64(math.MaxInt64)
7575
)
76+
if txset.Empty() {
77+
t.Fatalf("expected non-empty")
78+
}
7679
for {
7780
ltx, fee := txset.Peek()
7881
if ltx == nil {

0 commit comments

Comments
 (0)