@ -429,6 +429,15 @@ func (pool *LegacyPool) SubscribeTransactions(ch chan<- core.NewTxsEvent, reorgs
return pool . txFeed . Subscribe ( ch )
return pool . txFeed . Subscribe ( ch )
}
}
func ( pool * LegacyPool ) flushTransactionsBelowTip ( tip * big . Int ) {
// pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead
drop := pool . all . RemotesBelowTip ( tip )
for _ , tx := range drop {
pool . removeTx ( tx . Hash ( ) , false , true )
}
pool . priced . Removed ( len ( drop ) )
}
// SetGasTip updates the minimum gas tip required by the transaction pool for a
// SetGasTip updates the minimum gas tip required by the transaction pool for a
// new transaction, and drops all transactions below this threshold.
// new transaction, and drops all transactions below this threshold.
func ( pool * LegacyPool ) SetGasTip ( tip * big . Int ) {
func ( pool * LegacyPool ) SetGasTip ( tip * big . Int ) {
@ -442,16 +451,18 @@ func (pool *LegacyPool) SetGasTip(tip *big.Int) {
pool . gasTip . Store ( newTip )
pool . gasTip . Store ( newTip )
// If the min miner fee increased, remove transactions below the new threshold
// If the min miner fee increased, remove transactions below the new threshold
if newTip . Cmp ( old ) > 0 {
if newTip . Cmp ( old ) > 0 {
// pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead
pool . flushTransactionsBelowTip ( tip )
drop := pool . all . RemotesBelowTip ( tip )
for _ , tx := range drop {
pool . removeTx ( tx . Hash ( ) , false , true )
}
pool . priced . Removed ( len ( drop ) )
}
}
log . Info ( "Legacy pool tip threshold updated" , "tip" , newTip )
log . Info ( "Legacy pool tip threshold updated" , "tip" , newTip )
}
}
func ( pool * LegacyPool ) FlushAllTransactions ( ) {
maxUint256 := new ( big . Int ) . Sub ( new ( big . Int ) . Lsh ( common . Big1 , 256 ) , common . Big1 )
pool . mu . Lock ( )
defer pool . mu . Unlock ( )
pool . flushTransactionsBelowTip ( maxUint256 )
}
// Nonce returns the next nonce of an account, with all transactions executable
// Nonce returns the next nonce of an account, with all transactions executable
// by the pool already applied on top.
// by the pool already applied on top.
func ( pool * LegacyPool ) Nonce ( addr common . Address ) uint64 {
func ( pool * LegacyPool ) Nonce ( addr common . Address ) uint64 {