We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5ae16c commit e8b23daCopy full SHA for e8b23da
core/txpool/legacypool/list.go
@@ -160,12 +160,11 @@ func (m *sortedMap) Cap(threshold int) types.Transactions {
160
// Otherwise gather and drop the highest nonce'd transactions
161
var drops types.Transactions
162
163
- sort.Sort(*m.index)
164
for size := len(m.items); size > threshold; size-- {
165
- drops = append(drops, m.items[(*m.index)[size-1]])
166
- delete(m.items, (*m.index)[size-1])
+ dropIdx := m.index.Pop().(uint64)
+ drops = append(drops, m.items[dropIdx])
+ delete(m.items, dropIdx)
167
}
168
- *m.index = (*m.index)[:threshold]
169
170
// If we had a cache, shift the back
171
m.cacheMu.Lock()
0 commit comments