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) {
|
async processBlock (newBlockNumberHex) {
|
||||||
const newBlockNumber = Number.parseInt(newBlockNumberHex, 16)
|
const newBlockNumber = Number.parseInt(newBlockNumberHex, 16)
|
||||||
const newBlock = await this.getBlockByNumber(newBlockNumber, true)
|
const newBlock = await this.getBlockByNumber(newBlockNumber, true)
|
||||||
|
if (!newBlock) return
|
||||||
|
|
||||||
const block = this.mapTransactionsToPrices(newBlock)
|
const block = this.mapTransactionsToPrices(newBlock)
|
||||||
|
|
||||||
|
@ -135,10 +136,9 @@ class RecentBlocksController {
|
||||||
await Promise.all(targetBlockNumbers.map(async (targetBlockNumber) => {
|
await Promise.all(targetBlockNumbers.map(async (targetBlockNumber) => {
|
||||||
try {
|
try {
|
||||||
const newBlock = await this.getBlockByNumber(targetBlockNumber, true)
|
const newBlock = await this.getBlockByNumber(targetBlockNumber, true)
|
||||||
|
if (!newBlock) return
|
||||||
|
|
||||||
if (newBlock) {
|
this.backfillBlock(newBlock)
|
||||||
this.backfillBlock(newBlock)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error(e)
|
log.error(e)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue