mirror of
https://github.com/mempool/mempool.git
synced 2025-02-23 22:46:54 +01:00
Update bulk /txs to use new failover router, internal-api path
This commit is contained in:
parent
38909cfc42
commit
156b5d0b3c
2 changed files with 4 additions and 1 deletions
|
@ -214,7 +214,7 @@ class ElectrsApi implements AbstractBitcoinApi {
|
|||
}
|
||||
|
||||
async $getRawTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]> {
|
||||
return this.$postWrapper<IEsploraApi.Transaction[]>(config.ESPLORA.REST_API_URL + '/txs', txids, 'json');
|
||||
return this.failoverRouter.$post<IEsploraApi.Transaction[]>('/internal-api/txs', txids, 'json');
|
||||
}
|
||||
|
||||
async $getMempoolTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]> {
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Add table
Reference in a new issue