1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 18:41:38 +01:00

Set retry gasPrice to forceGasMin on confirm screen in cases where gas is not edited.

This commit is contained in:
Dan 2018-03-14 19:03:14 -02:30
parent 66422cd083
commit b0122be3c9
2 changed files with 34 additions and 4 deletions

View File

@ -493,9 +493,24 @@ ConfirmSendEther.prototype.gatherTxMeta = function () {
const txData = clone(state.txData) || clone(props.txData)
const { gasPrice: sendGasPrice, gas: sendGasLimit } = props.send
const { gasPrice: txGasPrice, gas: txGasLimit } = txData.txParams
const {
lastGasPrice,
txParams: {
gasPrice: txGasPrice,
gas: txGasLimit,
},
} = txData
txData.txParams.gasPrice = sendGasPrice || txGasPrice
let forceGasMin
if (lastGasPrice) {
forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
multiplicandBase: 16,
multiplierBase: 10,
toNumericBase: 'hex',
}))
}
txData.txParams.gasPrice = sendGasPrice || forceGasMin || txGasPrice
txData.txParams.gas = sendGasLimit || txGasLimit
// log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`)

View File

@ -486,9 +486,24 @@ ConfirmSendToken.prototype.gatherTxMeta = function () {
const txData = clone(state.txData) || clone(props.txData)
const { gasPrice: sendGasPrice, gas: sendGasLimit } = props.send
const { gasPrice: txGasPrice, gas: txGasLimit } = txData.txParams
const {
lastGasPrice,
txParams: {
gasPrice: txGasPrice,
gas: txGasLimit,
},
} = txData
txData.txParams.gasPrice = sendGasPrice || txGasPrice
let forceGasMin
if (lastGasPrice) {
forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
multiplicandBase: 16,
multiplierBase: 10,
toNumericBase: 'hex',
}))
}
txData.txParams.gasPrice = sendGasPrice || forceGasMin || txGasPrice
txData.txParams.gas = sendGasLimit || txGasLimit
// log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`)