diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-01-09 08:36:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-09 08:36:57 +0800 |
commit | 639bd293870493e7228eeb501f4c5ec72944796a (patch) | |
tree | 0cb5927e9b0077bd757a62db53013ca82aa8dd1a | |
parent | dcbecdc1fd7628873e4f8f530ff208c222d08434 (diff) | |
parent | dc3421079ac5211477b50ec16923af4bafaca951 (diff) | |
download | tangerine-wallet-browser-639bd293870493e7228eeb501f4c5ec72944796a.tar tangerine-wallet-browser-639bd293870493e7228eeb501f4c5ec72944796a.tar.gz tangerine-wallet-browser-639bd293870493e7228eeb501f4c5ec72944796a.tar.bz2 tangerine-wallet-browser-639bd293870493e7228eeb501f4c5ec72944796a.tar.lz tangerine-wallet-browser-639bd293870493e7228eeb501f4c5ec72944796a.tar.xz tangerine-wallet-browser-639bd293870493e7228eeb501f4c5ec72944796a.tar.zst tangerine-wallet-browser-639bd293870493e7228eeb501f4c5ec72944796a.zip |
Merge pull request #2902 from MetaMask/DefaultToOneGwei
Default to 1 gwei for empty blocks
-rw-r--r-- | app/scripts/metamask-controller.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 6ed0fd467..f62b5e5cd 100644 --- a/app/scripts/metamask-controller.js +++ b/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) |