diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/transactions/index.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index b44f66f14..1dd410d2c 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -229,7 +229,16 @@ class TransactionController extends EventEmitter { async retryTransaction (originalTxId) { const originalTxMeta = this.txStateManager.getTx(originalTxId) + const { txParams } = originalTxMeta const lastGasPrice = originalTxMeta.txParams.gasPrice + const suggestedGasPriceBN = new ethUtil.BN(ethUtil.stripHexPrefix(this.getGasPrice()), 16) + const lastGasPriceBN = new ethUtil.BN(ethUtil.stripHexPrefix(lastGasPrice), 16) + // essentially lastGasPrice * 1.1 but + // dont trust decimals so a round about way of doing that + const lastGasPriceBNBumped = lastGasPriceBN.mul(new ethUtil.BN(110, 10)).div(new ethUtil.BN(100, 10)) + // transactions that are being retried require a >=%10 bump or the clients will throw an error + txParams.gasPrice = suggestedGasPriceBN.gt(lastGasPriceBNBumped) ? `0x${suggestedGasPriceBN.toString(16)}` : `0x${lastGasPriceBNBumped.toString(16)}` + const txMeta = this.txStateManager.generateTxMeta({ txParams: originalTxMeta.txParams, lastGasPrice, |