Created
June 26, 2017 09:52
-
-
Save Arachnid/ddb7b5a71cfd05f75661942e9d62d6ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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