Use mempool/txs max_txs parameter
This commit is contained in:
parent
35d7c55c1d
commit
6454892d48
@ -5,7 +5,7 @@ export interface AbstractBitcoinApi {
|
|||||||
$getRawTransaction(txId: string, skipConversion?: boolean, addPrevout?: boolean, lazyPrevouts?: boolean): Promise<IEsploraApi.Transaction>;
|
$getRawTransaction(txId: string, skipConversion?: boolean, addPrevout?: boolean, lazyPrevouts?: boolean): Promise<IEsploraApi.Transaction>;
|
||||||
$getRawTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]>;
|
$getRawTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]>;
|
||||||
$getMempoolTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]>;
|
$getMempoolTransactions(txids: string[]): Promise<IEsploraApi.Transaction[]>;
|
||||||
$getAllMempoolTransactions(lastTxid: string);
|
$getAllMempoolTransactions(lastTxid?: string, max_txs?: number);
|
||||||
$getTransactionHex(txId: string): Promise<string>;
|
$getTransactionHex(txId: string): Promise<string>;
|
||||||
$getBlockHeightTip(): Promise<number>;
|
$getBlockHeightTip(): Promise<number>;
|
||||||
$getBlockHashTip(): Promise<string>;
|
$getBlockHashTip(): Promise<string>;
|
||||||
|
@ -77,7 +77,7 @@ class BitcoinApi implements AbstractBitcoinApi {
|
|||||||
throw new Error('Method getMempoolTransactions not supported by the Bitcoin RPC API.');
|
throw new Error('Method getMempoolTransactions not supported by the Bitcoin RPC API.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$getAllMempoolTransactions(lastTxid: string): Promise<IEsploraApi.Transaction[]> {
|
$getAllMempoolTransactions(lastTxid?: string, max_txs?: number): Promise<IEsploraApi.Transaction[]> {
|
||||||
throw new Error('Method getAllMempoolTransactions not supported by the Bitcoin RPC API.');
|
throw new Error('Method getAllMempoolTransactions not supported by the Bitcoin RPC API.');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -233,8 +233,8 @@ class ElectrsApi implements AbstractBitcoinApi {
|
|||||||
return this.failoverRouter.$post<IEsploraApi.Transaction[]>('/internal/mempool/txs', txids, 'json');
|
return this.failoverRouter.$post<IEsploraApi.Transaction[]>('/internal/mempool/txs', txids, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
async $getAllMempoolTransactions(lastSeenTxid?: string): Promise<IEsploraApi.Transaction[]> {
|
async $getAllMempoolTransactions(lastSeenTxid?: string, max_txs?: number): Promise<IEsploraApi.Transaction[]> {
|
||||||
return this.failoverRouter.$get<IEsploraApi.Transaction[]>('/internal/mempool/txs' + (lastSeenTxid ? '/' + lastSeenTxid : ''));
|
return this.failoverRouter.$get<IEsploraApi.Transaction[]>('/internal/mempool/txs' + (lastSeenTxid ? '/' + lastSeenTxid : ''), 'json', max_txs ? { max_txs } : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
$getTransactionHex(txId: string): Promise<string> {
|
$getTransactionHex(txId: string): Promise<string> {
|
||||||
|
@ -126,7 +126,7 @@ class Mempool {
|
|||||||
loadingIndicators.setProgress('mempool', count / expectedCount * 100);
|
loadingIndicators.setProgress('mempool', count / expectedCount * 100);
|
||||||
while (!done) {
|
while (!done) {
|
||||||
try {
|
try {
|
||||||
const result = await bitcoinApi.$getAllMempoolTransactions(last_txid);
|
const result = await bitcoinApi.$getAllMempoolTransactions(last_txid, config.ESPLORA.BATCH_QUERY_BASE_SIZE);
|
||||||
if (result) {
|
if (result) {
|
||||||
for (const tx of result) {
|
for (const tx of result) {
|
||||||
const extendedTransaction = transactionUtils.extendMempoolTransaction(tx);
|
const extendedTransaction = transactionUtils.extendMempoolTransaction(tx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user