go-ethereum – Fixing Low GasPrice Transaction Causing Pending Transactions

go-ethereumpending-transactionstransactions

I have a small private network that has a proof-of-authority engine created via geth-clique using Geth Version: 1.8.3-unstable, currently there are three signer nodes and two other non-signer nodes (lets call them peer-A and peer-B). peer-A and peer-B are connected to three signer nodes.

First, I sent a transaction with very low gasPrice such as 200, on peer-A as shown below.

eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value: web3.toWei(0,0000, "ether"), gasPrice: 200})

Later when I sent more transactions on peer-A even with greater gasPrice, all of those transactions will remain on the pending state. As I understand submitted transactions work as FIFO queue and my upcoming transactions are stuck
since the first send transaction with very low gasPrice locks others.

Example: (First peer-A and peer-B sent a Tx with low gasPrice and later their other Tx with high gasPrice stuck on their pending state.)
enter image description here

I have fix this situation by cleaning my chaindata on peer-A, which also cleans all pending transactions: rm -rf private/geth, and later I send my transactions with larger gasPrice. I assume this was a very inefficient solution for networks has a large chain.

So all sent transactions are provided as FIFO queue? Why not they selected based on which has the highest gasPrice?

Please note that I have tried:

eth.resend(eth.pendingTransactions[0], web3.toWei(1000, 'gwei'))

but faced with following error:

Error: intrinsic gas too low or Error: replacement transaction underpriced error.

[Q] How could I solve this problem, how could I remove the pending transaction on the system which has a low gasPrice or reject them or update their gasPrice value and resend() them?

Github issue: https://github.com/ethereum/go-ethereum/issues/16284

Best Answer

Péter Szilágyi's answer on (https://github.com/ethereum/go-ethereum/issues/16284) help me to solve the problem.

Every account and transaction in Ethereum has a nonce. At any given time, only the transaction with the correct nonce can be executed. If you submit a transaction with a low gas price, that will block all subsequent transactions since they are not executable nonce wise, only the next nonce is executable.

You don't need to clear your chain data folder, pending transactions are not stored there. There's a transactions.rlp file which saves the local transactions.

I was using eth.resend() with two parameters.

=> Adding gasLimit as third parameter solved it, example:

eth.resend(eth.pendingTransactions[0], web3.toWei(20, 'gwei'), 2000000)

=> Or stop the node, remove transactions.rlp file (rm ~/examplePOA/private/geth/transactions.rlp) and restart.

Related Topic