RSK: fix GasPrice calculation (changed output of minimumGasPrice)

This commit is contained in:
Victor Baranov 2020-04-29 16:09:40 +03:00
parent 724903ad66
commit b20644da1e
1 changed files with 4 additions and 6 deletions

View File

@ -1886,7 +1886,7 @@ module.exports = class MetamaskController extends EventEmitter {
resolve(gasPrice) resolve(gasPrice)
} }
} else if (isRSK) { } else if (isRSK) {
gasPrice = this.getGasPriceFromLastBlockRSK(networkId) gasPrice = this.getGasPriceFromLastBlockRSK()
resolve(gasPrice) resolve(gasPrice)
} else { } else {
gasPrice = this.getGasPriceFromBlocks(networkId) gasPrice = this.getGasPriceFromBlocks(networkId)
@ -1937,7 +1937,7 @@ module.exports = class MetamaskController extends EventEmitter {
* Related issue: https://github.com/poanetwork/nifty-wallet/issues/301 * Related issue: https://github.com/poanetwork/nifty-wallet/issues/301
* @returns {string} A hex representation of the suggested wei gas price. * @returns {string} A hex representation of the suggested wei gas price.
*/ */
getGasPriceFromLastBlockRSK (networkId) { getGasPriceFromLastBlockRSK () {
const { recentBlocksController } = this const { recentBlocksController } = this
const { recentBlocks } = recentBlocksController.store.getState() const { recentBlocks } = recentBlocksController.store.getState()
@ -1946,10 +1946,8 @@ module.exports = class MetamaskController extends EventEmitter {
const gasPrice = recentBlock && recentBlock.minimumGasPrice const gasPrice = recentBlock && recentBlock.minimumGasPrice
const gasPriceInt = parseInt(gasPrice, 10) if (gasPrice !== 0) {
return gasPrice
if (gasPriceInt !== 0) {
return '0x' + gasPriceInt.toString(16)
} else { } else {
return '0x' + GWEI_BN.toString(16) return '0x' + GWEI_BN.toString(16)
} }