Add backend checks for enabling fiat prices and update config paths

This commit is contained in:
natsoni
2024-03-10 17:12:19 +01:00
parent b11164005c
commit a5099fed75
4 changed files with 26 additions and 18 deletions

View File

@@ -116,7 +116,7 @@ class Indexer {
switch (task) {
case 'blocksPrices': {
if (!['testnet', 'signet'].includes(config.MEMPOOL.NETWORK)) {
if (!['testnet', 'signet'].includes(config.MEMPOOL.NETWORK) && config.FIAT_PRICE.ENABLED) {
let lastestPriceId;
try {
lastestPriceId = await PricesRepository.$getLatestPriceId();
@@ -148,10 +148,12 @@ class Indexer {
return;
}
try {
await priceUpdater.$run();
} catch (e) {
logger.err(`Running priceUpdater failed. Reason: ` + (e instanceof Error ? e.message : e));
if (config.FIAT_PRICE.ENABLED) {
try {
await priceUpdater.$run();
} catch (e) {
logger.err(`Running priceUpdater failed. Reason: ` + (e instanceof Error ? e.message : e));
}
}
// Do not attempt to index anything unless Bitcoin Core is fully synced