Tx Pool GC Rule
After receiving a valid new transaction from an account:
- If there is an old transaction from the same sender with the same nonce, replace the old transaction if any of the conditions holds:
- the
epoch_height
of the new transaction is 200000 more than the old one - the new transaction has a higher gas price
- the new transaction has the same gas price and a higher
epoch_height
- the
- If the transaction pool is full, try to garbage collect an old transaction:
- Try to garbage collect a transaction that has been packed (packed but not executed transactions will be inserted back to the tx pool later). This is the normal case when we receive a new transaction.
- If all transactions have not been packed, try to garbage a transaction that is not ready to be packed (with a non-consecutive nonce or not enough balance).
- If all transactions can be packed, choose a transaction (if an account has many ready transaction with consecutive nonces, only the one with the least nonce is considered here) with the least gas price. If the gas price is less than that of the newly received transaction, garbage collect this chosen old transaction.
- If the transaction pool is not full now, insert the new transaction. Otherwise, discard the new transaction.
No Comments