aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-01-09 07:08:05 +0800
committerDan Finlay <dan@danfinlay.com>2018-01-09 07:08:05 +0800
commit0275231e13d49a9b71b85af389d2a9850229eacb (patch)
tree3f9f65f30ebac81b2f60d72bbc823ce7dcdb0a81
parentf441bb7248d4b62d0d96897817655d348db0c29b (diff)
downloadtangerine-wallet-browser-0275231e13d49a9b71b85af389d2a9850229eacb.tar
tangerine-wallet-browser-0275231e13d49a9b71b85af389d2a9850229eacb.tar.gz
tangerine-wallet-browser-0275231e13d49a9b71b85af389d2a9850229eacb.tar.bz2
tangerine-wallet-browser-0275231e13d49a9b71b85af389d2a9850229eacb.tar.lz
tangerine-wallet-browser-0275231e13d49a9b71b85af389d2a9850229eacb.tar.xz
tangerine-wallet-browser-0275231e13d49a9b71b85af389d2a9850229eacb.tar.zst
tangerine-wallet-browser-0275231e13d49a9b71b85af389d2a9850229eacb.zip
Default gas estimate to 1 gwei for networks with no block activity
-rw-r--r--app/scripts/metamask-controller.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 66738db51..9462af494 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -490,6 +490,12 @@ module.exports = class MetamaskController extends EventEmitter {
getGasPrice () {
const { recentBlocksController } = this
const { recentBlocks } = recentBlocksController.store.getState()
+
+ // Return 1 gwei if no blocks have been observed:
+ if (recentBlocks.length === 0) {
+ return '0x' + GWEI_BN.toString(16)
+ }
+
const lowestPrices = recentBlocks.map((block) => {
if (!block.gasPrices) {
return new BN(0)