Skip to content

Commit 4199dea

Browse files
committed
fix cleanup in priority nonce
1 parent 0d6228e commit 4199dea

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

types/mempool/priority_nonce.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,13 @@ func (mp *PriorityNonceMempool[C]) Insert(ctx context.Context, tx sdk.Tx) error
257257
)
258258
}
259259

260-
mp.priorityIndex.Remove(txMeta[C]{
261-
nonce: nonce,
262-
sender: sender,
263-
priority: oldScore.priority,
264-
weight: oldScore.weight,
265-
})
260+
oldKey := txMeta[C]{nonce: nonce, sender: sender, priority: oldScore.priority, weight: oldScore.weight}
261+
mp.priorityIndex.Remove(oldKey)
262+
mp.senderIndices[sender].Remove(oldKey)
266263
mp.priorityCounts[oldScore.priority]--
264+
if mp.priorityCounts[oldScore.priority] == 0 {
265+
delete(mp.priorityCounts, oldScore.priority)
266+
}
267267
}
268268

269269
mp.priorityCounts[priority]++

0 commit comments

Comments
 (0)