[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 // Bitcoin Core
const bitcoinCoreBlockHeight = await bitcoinCoreApi.$getBlockHeightTip(); const bitcoinCoreBlockHeight = await bitcoinCoreApi.$getBlockHeightTip();
const bitcoinCoreIndexes = await bitcoinClient.getIndexInfo(); const bitcoinCoreIndexes = await bitcoinClient.getIndexInfo();
// Esplora
const esploraBlockHeight = await bitcoinApi.$getBlockHeightTip();
// Mempool // Mempool
const mempoolBlockHeight = blocks.getCurrentBlockHeight(); const mempoolBlockHeight = blocks.getCurrentBlockHeight();
const indexedBlockCount = await BlocksRepository.$getIndexedBlockCount(); const indexedBlockCount = await BlocksRepository.$getIndexedBlockCount();
@ -148,9 +146,6 @@ class BitcoinRoutes {
core: { core: {
height: bitcoinCoreBlockHeight, height: bitcoinCoreBlockHeight,
}, },
esplora: {
height: esploraBlockHeight
},
mempool: { mempool: {
height: mempoolBlockHeight, height: mempoolBlockHeight,
indexing: { indexing: {
@ -163,7 +158,14 @@ class BitcoinRoutes {
// Bitcoin Core indexes // Bitcoin Core indexes
for (const indexName in bitcoinCoreIndexes) { 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); res.json(response);