1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Enforce retry tx at minimum gas of previous tx

This commit is contained in:
Dan Finlay 2017-12-06 23:42:47 -05:00
parent 31564e0a86
commit 0e25129028
2 changed files with 13 additions and 2 deletions

View File

@ -185,7 +185,10 @@ module.exports = class TransactionController extends EventEmitter {
}
async retryTransaction (txId) {
return this.txStateManager.setTxStatusUnapproved(txId)
this.txStateManager.setTxStatusUnapproved(txId)
const txMeta = this.txStateManager.getTx(txId)
txMeta.lastGasPrice = txMeta.txParams.gasPrice
this.txStateManager.updateTx(txMeta, 'retryTransaction: manual retry')
}
async updateAndApproveTransaction (txMeta) {

View File

@ -38,6 +38,14 @@ PendingTx.prototype.render = function () {
const txMeta = this.gatherTxMeta()
const txParams = txMeta.txParams || {}
// Allow retry txs
const { lastGasPrice } = txMeta
let forceGasMin
if (lastGasPrice) {
const stripped = ethUtil.stripHexPrefix(lastGasPrice)
forceGasMin = new BN(stripped, 16).add(MIN_GAS_PRICE_BN)
}
// Account Details
const address = txParams.from || props.selectedAddress
const identity = props.identities[address] || { address: address }
@ -199,7 +207,7 @@ PendingTx.prototype.render = function () {
precision: 9,
scale: 9,
suffix: 'GWEI',
min: MIN_GAS_PRICE_BN,
min: forceGasMin || MIN_GAS_PRICE_BN,
style: {
position: 'relative',
top: '5px',