[health api] replace space with _ | only add esplora if enabled

This commit is contained in:
nymkappa 2023-09-26 16:44:08 +02:00
parent 8a51f32e63
commit 3c23e3ff84
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -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);