Fix for difficulty adjustment throwing error before in sync

This commit is contained in:
softsimon
2022-08-27 10:25:24 +02:00
parent 53ad2e98f1
commit e4514e8a01
2 changed files with 10 additions and 4 deletions

View File

@@ -510,7 +510,12 @@ class BitcoinRoutes {
private getDifficultyChange(req: Request, res: Response) {
try {
res.json(difficultyAdjustment.getDifficultyAdjustment());
const da = difficultyAdjustment.getDifficultyAdjustment();
if (da) {
res.json(da);
} else {
res.status(503).send(`Service Temporarily Unavailable`);
}
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);
}