-
Notifications
You must be signed in to change notification settings - Fork 21.3k
Description
System information
Geth version: 1.11.6
Expected behaviour
be able to replace a transaction in case mempool is full
Actual behaviour
trying to replace a transaction when mempool is full results in
ErrFutureReplacePending = errors.New("future transaction tries to replace pending")
which was introduced in v1.11.5
and modified in v1.11.6
Steps to reproduce the behaviour
In case mempool is full, have a pending transaction, and try to send a transaction with the same nonce and higher gas to replace it
Looks like the issue is in the implementation of the new isGapped
function https://github.com/ethereum/go-ethereum/blob/master/core/txpool/txpool.go#L825
consider having a pending transaction with nonce n
which is pending
and the mempool now receives a new transaction with nonce n
then next
value will be n+1
, skipping the first if , but queue
is currently empty, causing the if to return true
in line 836:
go-ethereum/core/txpool/txpool.go
Line 836 in 2372fb2
return true |
I believe a possible fix will be to change this condition
go-ethereum/core/txpool/txpool.go
Line 829 in 2372fb2
if tx.Nonce() == next { |
from
tx.Nonce() == next
to tx.Nonce() <= next
happy to open a PR if that's an acceptable solution