controllers - recent-blocks - guard against empty block
This commit is contained in:
parent
ee800de025
commit
49ef93b991
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue