Skip to content

error replacing a transaction if queue is full #27401

@dkatzan

Description

@dkatzan

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:

return true

I believe a possible fix will be to change this condition

if tx.Nonce() == next {

from tx.Nonce() == next to tx.Nonce() <= next

happy to open a PR if that's an acceptable solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions