diff --git a/backend/src/api/bitcoin/esplora-api.ts b/backend/src/api/bitcoin/esplora-api.ts index 209a6ceec..c80a9e18f 100644 --- a/backend/src/api/bitcoin/esplora-api.ts +++ b/backend/src/api/bitcoin/esplora-api.ts @@ -344,16 +344,20 @@ class ElectrsApi implements AbstractBitcoinApi { } public getHealthStatus(): HealthCheckHost[] { - return this.failoverRouter.sortHosts().map(host => ({ - host: host.host, - active: host === this.failoverRouter.activeHost, - rtt: host.rtt, - latestHeight: host.latestHeight || 0, - socket: !!host.socket, - outOfSync: !!host.outOfSync, - unreachable: !!host.unreachable, - checked: !!host.checked, - })); + if (config.MEMPOOL.OFFICIAL) { + return this.failoverRouter.sortHosts().map(host => ({ + host: host.host, + active: host === this.failoverRouter.activeHost, + rtt: host.rtt, + latestHeight: host.latestHeight || 0, + socket: !!host.socket, + outOfSync: !!host.outOfSync, + unreachable: !!host.unreachable, + checked: !!host.checked, + })); + } else { + return []; + } } } diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index b2507122f..6711c88fb 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -149,7 +149,7 @@ class WebsocketHandler { response['da'] = this.socketData['da']; } - if (wantNow['want-tomahawk'] && config.MEMPOOL.BACKEND === 'esplora' && config.ESPLORA.FALLBACK?.length) { + if (wantNow['want-tomahawk']) { response['tomahawk'] = JSON.stringify(bitcoinApi.getHealthStatus()); } @@ -552,7 +552,7 @@ class WebsocketHandler { response['mempool-blocks'] = getCachedResponse('mempool-blocks', mBlocks); } - if (client['want-tomahawk'] && config.MEMPOOL.BACKEND === 'esplora' && config.ESPLORA.FALLBACK?.length) { + if (client['want-tomahawk']) { response['tomahawk'] = getCachedResponse('tomahawk', bitcoinApi.getHealthStatus()); } @@ -919,7 +919,7 @@ class WebsocketHandler { response['mempool-blocks'] = getCachedResponse('mempool-blocks', mBlocks); } - if (client['want-tomahawk'] && config.MEMPOOL.BACKEND === 'esplora' && config.ESPLORA.FALLBACK?.length) { + if (client['want-tomahawk']) { response['tomahawk'] = getCachedResponse('tomahawk', bitcoinApi.getHealthStatus()); }