Batch outspends requests

fixes #1902
This commit is contained in:
softsimon
2022-06-22 23:34:44 +02:00
parent 816263bd54
commit 1479039fb5
7 changed files with 67 additions and 18 deletions

View File

@@ -141,6 +141,15 @@ class BitcoinApi implements AbstractBitcoinApi {
return outSpends;
}
async $getBatchedOutspends(txId: string[]): Promise<IEsploraApi.Outspend[][]> {
const outspends: IEsploraApi.Outspend[][] = [];
for (const tx of txId) {
const outspend = await this.$getOutspends(tx);
outspends.push(outspend);
}
return outspends;
}
$getEstimatedHashrate(blockHeight: number): Promise<number> {
// 120 is the default block span in Core
return this.bitcoindClient.getNetworkHashPs(120, blockHeight);