Why is my transaction queued?

This document describes why your transactions might have a status of “queued” in your node’s local transaction pool and offers some ways that you can change that transaction’s state. The local transaction pool can hold as many pending and queued transactions as the node’s memory will allow. Please note that your node’s local transaction pool is different than the main-net transaction pool.

Here are some useful Geth and Web3.js API calls to use when inspecting transactions:

txpool.status: gives the number of transactions in pending and queued states

txpool.content: gives details on each transaction in pending and queued states

eth.getTransactionCount(eth.coinbase): gives the total number of validated transactions sent from a given account

eth.getTransaction(“<transaction_hash>”): gives details about a single validated transaction

Cause

If a transaction is sent with a nonce that is higher than the current transaction count for the sender’s account (creating a gap in the nonces), then the transaction will be added to the node’s local transaction pool with a queued state. The transaction will not be promoted to the “pending” state until the gap in nonces is filled and the “queued” transaction nonce becomes the next one in sequence.

NOTE: Alternatively, if the nonce of a transaction is lower than the sender’s transaction count, then the transaction will simply be discarded.

Potential Fixes

Fill the gap of nonces. For example, if the eth.getTransactionCount(eth.coinbase)==5 and there is a queued transaction with nonce=7, send valid transactions with nonce=5 and nonce=6 to get the queued transaction unclogged and added to a block.

One way to effectively cancel a queued transaction is to send another transaction from the same account with the same nonce, but with a gasPrice that is at least 10% higher than the gasPrice of the original transaction. This new transaction could be one that sends 0ETH with fromAccount=toAccount so that the only cost of the transaction is its gas.

If you are creating a Geth node on your own without using Kaleido, you will have access to the node’s file system and may use the following fix. Delete the file containing the contents of the queued transactions from the node’s local memory. This will delete ALL of the queued transactions simultaneously.