added conditional transaction filtering in legacypool

This commit is contained in:
Pratik Patil 2023-11-08 16:23:43 +05:30
parent 1483c960ed
commit aa604a6744
No known key found for this signature in database
GPG key ID: D883140B4FA928F6

View file

@ -1666,9 +1666,18 @@ func (pool *LegacyPool) demoteUnexecutables() {
// Internal shuffle shouldn't touch the lookup set.
pool.enqueueTx(hash, tx, false, false)
}
pendingGauge.Dec(int64(len(olds) + len(drops) + len(invalids)))
// Drop all transactions that no longer have valid TxOptions
txConditionalsRemoved := list.FilterTxConditional(pool.currentState)
for _, tx := range txConditionalsRemoved {
hash := tx.Hash()
pool.all.Remove(hash)
log.Trace("Removed invalid conditional transaction", "hash", hash)
}
pendingGauge.Dec(int64(len(olds) + len(drops) + len(invalids) + len(txConditionalsRemoved)))
if pool.locals.contains(addr) {
localGauge.Dec(int64(len(olds) + len(drops) + len(invalids)))
localGauge.Dec(int64(len(olds) + len(drops) + len(invalids) + len(txConditionalsRemoved)))
}
// If there's a gap in front, alert (should never happen) and postpone all transactions
if list.Len() > 0 && list.txs.Get(nonce) == nil {