From 0275231e13d49a9b71b85af389d2a9850229eacb Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 8 Jan 2018 15:08:05 -0800 Subject: [PATCH] Default gas estimate to 1 gwei for networks with no block activity --- app/scripts/metamask-controller.js | 6 ++++++ 1 file changed, 6 insertions(+) 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)