Merge pull request #2902 from MetaMask/DefaultToOneGwei

Default to 1 gwei for empty blocks
feature/default_network_editable
Dan Finlay 7 years ago committed by GitHub
commit 639bd29387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/scripts/metamask-controller.js

@ -497,7 +497,7 @@ module.exports = class MetamaskController extends EventEmitter {
}
const lowestPrices = recentBlocks.map((block) => {
if (!block.gasPrices) {
if (!block.gasPrices || block.gasPrices.length < 1) {
return GWEI_BN
}
return block.gasPrices
@ -508,6 +508,7 @@ module.exports = class MetamaskController extends EventEmitter {
})[0]
})
.map(number => number.div(GWEI_BN).toNumber())
const percentileNum = percentile(50, lowestPrices)
const percentileNumBn = new BN(percentileNum)
return '0x' + percentileNumBn.mul(GWEI_BN).toString(16)

Loading…
Cancel
Save