@@ -420,18 +420,16 @@ func (l *txPricedList) Removed() {
420
420
heap .Init (l .items )
421
421
}
422
422
423
- // Discard finds all the transactions below the given price threshold, drops them
423
+ // Cap finds all the transactions below the given price threshold, drops them
424
424
// from the priced list and returs them for further removal from the entire pool.
425
- func (l * txPricedList ) Cap (threshold * big.Int , local * txSet ) types.Transactions {
425
+ func (l * txPricedList ) Cap (threshold * big.Int , local * accountSet ) types.Transactions {
426
426
drop := make (types.Transactions , 0 , 128 ) // Remote underpriced transactions to drop
427
427
save := make (types.Transactions , 0 , 64 ) // Local underpriced transactions to keep
428
428
429
429
for len (* l .items ) > 0 {
430
430
// Discard stale transactions if found during cleanup
431
431
tx := heap .Pop (l .items ).(* types.Transaction )
432
-
433
- hash := tx .Hash ()
434
- if _ , ok := (* l .all )[hash ]; ! ok {
432
+ if _ , ok := (* l .all )[tx .Hash ()]; ! ok {
435
433
l .stales --
436
434
continue
437
435
}
@@ -440,7 +438,7 @@ func (l *txPricedList) Cap(threshold *big.Int, local *txSet) types.Transactions
440
438
break
441
439
}
442
440
// Non stale transaction found, discard unless local
443
- if local .contains ( hash ) {
441
+ if local .containsTx ( tx ) {
444
442
save = append (save , tx )
445
443
} else {
446
444
drop = append (drop , tx )
@@ -454,9 +452,9 @@ func (l *txPricedList) Cap(threshold *big.Int, local *txSet) types.Transactions
454
452
455
453
// Underpriced checks whether a transaction is cheaper than (or as cheap as) the
456
454
// lowest priced transaction currently being tracked.
457
- func (l * txPricedList ) Underpriced (tx * types.Transaction , local * txSet ) bool {
455
+ func (l * txPricedList ) Underpriced (tx * types.Transaction , local * accountSet ) bool {
458
456
// Local transactions cannot be underpriced
459
- if local .contains (tx . Hash () ) {
457
+ if local .containsTx (tx ) {
460
458
return false
461
459
}
462
460
// Discard stale price points if found at the heap start
@@ -479,22 +477,20 @@ func (l *txPricedList) Underpriced(tx *types.Transaction, local *txSet) bool {
479
477
}
480
478
481
479
// Discard finds a number of most underpriced transactions, removes them from the
482
- // priced list and returs them for further removal from the entire pool.
483
- func (l * txPricedList ) Discard (count int , local * txSet ) types.Transactions {
480
+ // priced list and returns them for further removal from the entire pool.
481
+ func (l * txPricedList ) Discard (count int , local * accountSet ) types.Transactions {
484
482
drop := make (types.Transactions , 0 , count ) // Remote underpriced transactions to drop
485
483
save := make (types.Transactions , 0 , 64 ) // Local underpriced transactions to keep
486
484
487
485
for len (* l .items ) > 0 && count > 0 {
488
486
// Discard stale transactions if found during cleanup
489
487
tx := heap .Pop (l .items ).(* types.Transaction )
490
-
491
- hash := tx .Hash ()
492
- if _ , ok := (* l .all )[hash ]; ! ok {
488
+ if _ , ok := (* l .all )[tx .Hash ()]; ! ok {
493
489
l .stales --
494
490
continue
495
491
}
496
492
// Non stale transaction found, discard unless local
497
- if local .contains ( hash ) {
493
+ if local .containsTx ( tx ) {
498
494
save = append (save , tx )
499
495
} else {
500
496
drop = append (drop , tx )
0 commit comments