[Ethereum] geth transactions stuck in pending, resend fails


I sent 115 transactions with geth, and they are stuck in pending for over an hour. Etherscan doesn't recognize them. I try to resend, and get a confusing error. Some details from geth console:

> eth.pendingTransactions.length

> eth.resend(eth.pendingTransactions[0], web3.toWei(20, 'gwei'))
Error: Transaction a075b95c7242178330ae22373a1138e9ec22cbd9dd54964980fc1a36182acdbe not found
    at web3.js:3104:20
    at web3.js:6191:15
    at web3.js:5004:36
    at <anonymous>:1:1

> eth.pendingTransactions[0].hash == "0xa075b95c7242178330ae22373a1138e9ec22cbd9dd54964980fc1a36182acdbe"

The eth.resend docs don't offer much more help.

This might be a duplicate of: geth: can not resend transaction – transaction not found

*Edit: fixed code typo in the writeup (but typo was not in the console).

Interestingly, the pool did eventually clear out on its own, after 24 hours, and all the transactions were successfully sent. But the question about why eth.resend() was failing still stands. (or perhaps clarification on the purpose of the function)

Best Answer

I still don't know why eth.resend was failing (and continues to fail as of geth 1.6.5), but this compatible patch works for me:

eth.resend = function (tx, gasPrice, gas) {
  if (gasPrice) {
    tx.gasPrice = gasPrice;
  if (gas) {
    tx.gas = gas;
  tx.data = tx.input;
  return eth.sendTransaction(tx);

I prefer to also add this convenience version:

eth.resendgwei = function (tx, gasPriceInGwei, gas) {
  if (gasPriceInGwei) {
    return eth.resend(tx, web3.toWei(gasPriceInGwei, 'gwei'), gas);
  else {
    return eth.resend(tx, null, gas);

Now, if your pending transaction is stuck because the gas price is too low, you can speed it up with:

eth.resendgwei(eth.pendingTransactions[0], 27);
Related Topic