add a comment

This commit is contained in:
colinlyguo 2024-02-13 21:49:13 +08:00
parent 2b9e72c7bf
commit 7f5b1474eb
No known key found for this signature in database
GPG key ID: 82E123BE1B68288B

View file

@ -160,7 +160,7 @@ func (m *sortedMap) Cap(threshold int) types.Transactions {
// Otherwise gather and drop the highest nonce'd transactions
var drops types.Transactions
sort.Sort(*m.index)
sort.Sort(*m.index) // the sorted array is a heap, so no need to reheap after deleting tail items
for size := len(m.items); size > threshold; size-- {
drops = append(drops, m.items[(*m.index)[size-1]])
delete(m.items, (*m.index)[size-1])