diff --git a/backend/src/api/bitcoin/bitcoin-api-abstract-factory.ts b/backend/src/api/bitcoin/bitcoin-api-abstract-factory.ts index f008e5ed8..5bd961e23 100644 --- a/backend/src/api/bitcoin/bitcoin-api-abstract-factory.ts +++ b/backend/src/api/bitcoin/bitcoin-api-abstract-factory.ts @@ -5,7 +5,7 @@ export interface AbstractBitcoinApi { $getRawTransaction(txId: string, skipConversion?: boolean, addPrevout?: boolean, lazyPrevouts?: boolean): Promise; $getRawTransactions(txids: string[]): Promise; $getMempoolTransactions(txids: string[]): Promise; - $getAllMempoolTransactions(lastTxid: string); + $getAllMempoolTransactions(lastTxid?: string, max_txs?: number); $getTransactionHex(txId: string): Promise; $getBlockHeightTip(): Promise; $getBlockHashTip(): Promise; diff --git a/backend/src/api/bitcoin/bitcoin-api.ts b/backend/src/api/bitcoin/bitcoin-api.ts index 1722334df..f54c836f8 100644 --- a/backend/src/api/bitcoin/bitcoin-api.ts +++ b/backend/src/api/bitcoin/bitcoin-api.ts @@ -77,7 +77,7 @@ class BitcoinApi implements AbstractBitcoinApi { throw new Error('Method getMempoolTransactions not supported by the Bitcoin RPC API.'); } - $getAllMempoolTransactions(lastTxid: string): Promise { + $getAllMempoolTransactions(lastTxid?: string, max_txs?: number): Promise { throw new Error('Method getAllMempoolTransactions not supported by the Bitcoin RPC API.'); } diff --git a/backend/src/api/bitcoin/esplora-api.ts b/backend/src/api/bitcoin/esplora-api.ts index fe152e2a3..c0b548b9a 100644 --- a/backend/src/api/bitcoin/esplora-api.ts +++ b/backend/src/api/bitcoin/esplora-api.ts @@ -233,8 +233,8 @@ class ElectrsApi implements AbstractBitcoinApi { return this.failoverRouter.$post('/internal/mempool/txs', txids, 'json'); } - async $getAllMempoolTransactions(lastSeenTxid?: string): Promise { - return this.failoverRouter.$get('/internal/mempool/txs' + (lastSeenTxid ? '/' + lastSeenTxid : '')); + async $getAllMempoolTransactions(lastSeenTxid?: string, max_txs?: number): Promise { + return this.failoverRouter.$get('/internal/mempool/txs' + (lastSeenTxid ? '/' + lastSeenTxid : ''), 'json', max_txs ? { max_txs } : null); } $getTransactionHex(txId: string): Promise { diff --git a/backend/src/api/mempool.ts b/backend/src/api/mempool.ts index a11e0d504..60bcd2f99 100644 --- a/backend/src/api/mempool.ts +++ b/backend/src/api/mempool.ts @@ -126,7 +126,7 @@ class Mempool { loadingIndicators.setProgress('mempool', count / expectedCount * 100); while (!done) { try { - const result = await bitcoinApi.$getAllMempoolTransactions(last_txid); + const result = await bitcoinApi.$getAllMempoolTransactions(last_txid, config.ESPLORA.BATCH_QUERY_BASE_SIZE); if (result) { for (const tx of result) { const extendedTransaction = transactionUtils.extendMempoolTransaction(tx);