From 156b5d0b3c33e775eeb158f16a4d4d4be48ed710 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Wed, 16 Aug 2023 18:30:18 +0900 Subject: [PATCH] Update bulk /txs to use new failover router, internal-api path --- backend/src/api/bitcoin/esplora-api.ts | 2 +- backend/src/api/rbf-cache.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/api/bitcoin/esplora-api.ts b/backend/src/api/bitcoin/esplora-api.ts index 1ebfef8c8..3264e8725 100644 --- a/backend/src/api/bitcoin/esplora-api.ts +++ b/backend/src/api/bitcoin/esplora-api.ts @@ -214,7 +214,7 @@ class ElectrsApi implements AbstractBitcoinApi { } async $getRawTransactions(txids: string[]): Promise { - return this.$postWrapper(config.ESPLORA.REST_API_URL + '/txs', txids, 'json'); + return this.failoverRouter.$post('/internal-api/txs', txids, 'json'); } async $getMempoolTransactions(txids: string[]): Promise { diff --git a/backend/src/api/rbf-cache.ts b/backend/src/api/rbf-cache.ts index 7d95df27b..b7d6f11a6 100644 --- a/backend/src/api/rbf-cache.ts +++ b/backend/src/api/rbf-cache.ts @@ -505,10 +505,13 @@ class RbfCache { if (config.MEMPOOL.BACKEND === 'esplora') { const sliceLength = 10000; + let count = 0; for (let i = 0; i < Math.ceil(txids.length / sliceLength); i++) { const slice = txids.slice(i * sliceLength, (i + 1) * sliceLength); try { const txs = await bitcoinApi.$getRawTransactions(slice); + count += txs.length; + logger.info(`Fetched ${count} of ${txids.length} unknown-status RBF transactions from esplora`); processTxs(txs); } catch (err) { logger.err('failed to fetch some cached rbf transactions');