Update bulk /txs to use new failover router, internal-api path
This commit is contained in:
parent
38909cfc42
commit
156b5d0b3c
@ -214,7 +214,7 @@ class ElectrsApi implements AbstractBitcoinApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async $getRawTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]> {
|
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[]> {
|
async $getMempoolTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]> {
|
||||||
|
@ -505,10 +505,13 @@ class RbfCache {
|
|||||||
|
|
||||||
if (config.MEMPOOL.BACKEND === 'esplora') {
|
if (config.MEMPOOL.BACKEND === 'esplora') {
|
||||||
const sliceLength = 10000;
|
const sliceLength = 10000;
|
||||||
|
let count = 0;
|
||||||
for (let i = 0; i < Math.ceil(txids.length / sliceLength); i++) {
|
for (let i = 0; i < Math.ceil(txids.length / sliceLength); i++) {
|
||||||
const slice = txids.slice(i * sliceLength, (i + 1) * sliceLength);
|
const slice = txids.slice(i * sliceLength, (i + 1) * sliceLength);
|
||||||
try {
|
try {
|
||||||
const txs = await bitcoinApi.$getRawTransactions(slice);
|
const txs = await bitcoinApi.$getRawTransactions(slice);
|
||||||
|
count += txs.length;
|
||||||
|
logger.info(`Fetched ${count} of ${txids.length} unknown-status RBF transactions from esplora`);
|
||||||
processTxs(txs);
|
processTxs(txs);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.err('failed to fetch some cached rbf transactions');
|
logger.err('failed to fetch some cached rbf transactions');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user