1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Default gas estimate to 1 gwei for networks with no block activity

This commit is contained in:
Dan Finlay 2018-01-08 15:08:05 -08:00
parent f441bb7248
commit 0275231e13

View File

@ -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)