Wrap orphaned blocks updater into try/catch
This commit is contained in:
parent
281899f551
commit
e2fe39f241
@ -19,6 +19,7 @@ class ChainTips {
|
|||||||
private orphanedBlocks: OrphanedBlock[] = [];
|
private orphanedBlocks: OrphanedBlock[] = [];
|
||||||
|
|
||||||
public async updateOrphanedBlocks(): Promise<void> {
|
public async updateOrphanedBlocks(): Promise<void> {
|
||||||
|
try {
|
||||||
this.chainTips = await bitcoinClient.getChainTips();
|
this.chainTips = await bitcoinClient.getChainTips();
|
||||||
this.orphanedBlocks = [];
|
this.orphanedBlocks = [];
|
||||||
|
|
||||||
@ -37,6 +38,9 @@ class ChainTips {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(`Updated orphaned blocks cache. Found ${this.orphanedBlocks.length} orphaned blocks`);
|
logger.debug(`Updated orphaned blocks cache. Found ${this.orphanedBlocks.length} orphaned blocks`);
|
||||||
|
} catch (e) {
|
||||||
|
logger.err(`Cannot get fetch orphaned blocks. Reason: ${e instanceof Error ? e.message : e}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getOrphanedBlocksAtHeight(height: number): OrphanedBlock[] {
|
public getOrphanedBlocksAtHeight(height: number): OrphanedBlock[] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user