From 49ef93b99158b9fae21d841828d7e7d105f837df Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 24 May 2018 13:43:16 -0700 Subject: [PATCH] controllers - recent-blocks - guard against empty block --- app/scripts/controllers/recent-blocks.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/scripts/controllers/recent-blocks.js b/app/scripts/controllers/recent-blocks.js index e256c62e0..4009c35ae 100644 --- a/app/scripts/controllers/recent-blocks.js +++ b/app/scripts/controllers/recent-blocks.js @@ -64,6 +64,7 @@ class RecentBlocksController { async processBlock (newBlockNumberHex) { const newBlockNumber = Number.parseInt(newBlockNumberHex, 16) const newBlock = await this.getBlockByNumber(newBlockNumber, true) + if (!newBlock) return const block = this.mapTransactionsToPrices(newBlock) @@ -135,10 +136,9 @@ class RecentBlocksController { await Promise.all(targetBlockNumbers.map(async (targetBlockNumber) => { try { const newBlock = await this.getBlockByNumber(targetBlockNumber, true) + if (!newBlock) return - if (newBlock) { - this.backfillBlock(newBlock) - } + this.backfillBlock(newBlock) } catch (e) { log.error(e) }