You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When 2 transactions are submitted concurrently, it is possible for transaction A to be submitted with nonce X and transaction B to be submitted with the same nonce. This leads to the Geth error "transaction replacement is underpriced" because Geth thinks the transaction B is meant to be a replacement transaction which would require a higher gas price than transaction A.
This is because the Go contract bindings for our contracts use the RPC method getTransactionCount(addr, "pending") to retrieve the nonce to be used for a transaction. getTransactionCount(addr, "pending") SHOULD return the next nonce taking into account an account's pending transactions in the transaction pool. However, at the moment getTransactionCount(addr, "pending") instead only takes into account pending transactions in the pending block which is the block currently being mined or the latest canonical block if the node you are connected to is not a miner. As a result, the nonce retrieved will not reflect any pending transactions sitting in the transaction pool and transactions submitted concurrently (or close in time to each other) can be submitted with the same nonce.
When 2 transactions are submitted concurrently, it is possible for transaction A to be submitted with nonce X and transaction B to be submitted with the same nonce. This leads to the Geth error "transaction replacement is underpriced" because Geth thinks the transaction B is meant to be a replacement transaction which would require a higher gas price than transaction A.
This is because the Go contract bindings for our contracts use the RPC method
getTransactionCount(addr, "pending")
to retrieve the nonce to be used for a transaction.getTransactionCount(addr, "pending")
SHOULD return the next nonce taking into account an account's pending transactions in the transaction pool. However, at the momentgetTransactionCount(addr, "pending")
instead only takes into account pending transactions in the pending block which is the block currently being mined or the latest canonical block if the node you are connected to is not a miner. As a result, the nonce retrieved will not reflect any pending transactions sitting in the transaction pool and transactions submitted concurrently (or close in time to each other) can be submitted with the same nonce.There is an open issue in Geth, but it is not fixed yet: ethereum/go-ethereum#2880
Some possible alternative solutions for nonce tracking can be documented here
The text was updated successfully, but these errors were encountered: