From 3c23e3ff84a5cfb8070c2c75dc32ae86c6c193e6 Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Tue, 26 Sep 2023 16:44:08 +0200 Subject: [PATCH] [health api] replace space with _ | only add esplora if enabled --- backend/src/api/bitcoin/bitcoin.routes.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/src/api/bitcoin/bitcoin.routes.ts b/backend/src/api/bitcoin/bitcoin.routes.ts index 103158ad5..fec31c4a3 100644 --- a/backend/src/api/bitcoin/bitcoin.routes.ts +++ b/backend/src/api/bitcoin/bitcoin.routes.ts @@ -136,8 +136,6 @@ class BitcoinRoutes { // Bitcoin Core const bitcoinCoreBlockHeight = await bitcoinCoreApi.$getBlockHeightTip(); const bitcoinCoreIndexes = await bitcoinClient.getIndexInfo(); - // Esplora - const esploraBlockHeight = await bitcoinApi.$getBlockHeightTip(); // Mempool const mempoolBlockHeight = blocks.getCurrentBlockHeight(); const indexedBlockCount = await BlocksRepository.$getIndexedBlockCount(); @@ -148,9 +146,6 @@ class BitcoinRoutes { core: { height: bitcoinCoreBlockHeight, }, - esplora: { - height: esploraBlockHeight - }, mempool: { height: mempoolBlockHeight, indexing: { @@ -163,7 +158,14 @@ class BitcoinRoutes { // Bitcoin Core indexes for (const indexName in bitcoinCoreIndexes) { - response.core[indexName] = bitcoinCoreIndexes[indexName]; + response.core[indexName.replace(/ /g,'_')] = bitcoinCoreIndexes[indexName]; + } + + if (config.MEMPOOL.BACKEND === 'esplora') { + const esploraBlockHeight = await bitcoinApi.$getBlockHeightTip(); + response['esplora'] = { + height: esploraBlockHeight + }; } res.json(response);