Skip to content

Instantly share code, notes, and snippets.

@Arachnid
Created June 26, 2017 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arachnid/ddb7b5a71cfd05f75661942e9d62d6ca to your computer and use it in GitHub Desktop.
Save Arachnid/ddb7b5a71cfd05f75661942e9d62d6ca to your computer and use it in GitHub Desktop.
// Example usage: `bumpGasPrice(web3.toWei(2, 'gwei'))`
function bumpGasPrice(minprice) {
for(var i = 0; i < eth.accounts.length; i++) {
var account = eth.accounts[i];
var pending = txpool.content.pending[account];
if(pending === undefined) continue;
Object.keys(pending).forEach(function(nonce) {
var tx = pending[nonce];
var gasPrice = new BigNumber(tx.gasPrice.slice(2), 16);
if(gasPrice < minprice) {
eth.sendTransaction({
from: tx.from,
gas: tx.gas,
gasPrice: minprice,
input: tx.input,
nonce: tx.nonce,
to: tx.to,
value: tx.value,
})
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment