Wrap orphaned blocks updater into try/catch

This commit is contained in:
nymkappa 2023-02-18 14:53:21 +09:00
parent 281899f551
commit e2fe39f241
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -19,6 +19,7 @@ class ChainTips {
private orphanedBlocks: OrphanedBlock[] = [];
public async updateOrphanedBlocks(): Promise<void> {
try {
this.chainTips = await bitcoinClient.getChainTips();
this.orphanedBlocks = [];
@ -37,6 +38,9 @@ class ChainTips {
}
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[] {