all: EIP-1559 tx pool support (#22898)

This pull request implements EIP-1559 compatible transaction pool with dual heap eviction ordering.
It is based on #22791
The eviction ordering scheme and the reasoning behind it is described here: https://gist.github.com/zsfelfoldi/9607ad248707a925b701f49787904fd6
This commit is contained in:
Felföldi Zsolt
2021-05-28 10:28:07 +02:00
committed by GitHub
parent ee35ddc8fd
commit 966ee3ae6d
5 changed files with 747 additions and 147 deletions

View File

@ -188,7 +188,7 @@ type transactionsByGasPrice []*types.Transaction
func (t transactionsByGasPrice) Len() int { return len(t) }
func (t transactionsByGasPrice) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
func (t transactionsByGasPrice) Less(i, j int) bool { return t[i].GasPriceCmp(t[j]) < 0 }
func (t transactionsByGasPrice) Less(i, j int) bool { return t[i].FeeCapCmp(t[j]) < 0 }
// getBlockPrices calculates the lowest transaction gas price in a given block
// and sends it to the result channel. If the block is empty or all transactions
@ -210,7 +210,7 @@ func (gpo *Oracle) getBlockPrices(ctx context.Context, signer types.Signer, bloc
var prices []*big.Int
for _, tx := range txs {
if ignoreUnder != nil && tx.GasPriceIntCmp(ignoreUnder) == -1 {
if ignoreUnder != nil && tx.GasPrice().Cmp(ignoreUnder) == -1 {
continue
}
sender, err := types.Sender(signer, tx)