Refactoring Bitcoin RPC client implementation

This commit is contained in:
softsimon
2021-09-15 01:47:24 +04:00
parent d602b20f56
commit 641d2ad028
13 changed files with 71 additions and 85 deletions

View File

@@ -6,7 +6,7 @@ import { BlockExtended, TransactionExtended } from '../mempool.interfaces';
import { Common } from './common';
import diskCache from './disk-cache';
import transactionUtils from './transaction-utils';
import bitcoinBaseApi from './bitcoin/bitcoin-base.api';
import bitcoinClient from './bitcoin/bitcoin-client';
class Blocks {
private blocks: BlockExtended[] = [];
@@ -45,7 +45,7 @@ class Blocks {
}
if (!this.lastDifficultyAdjustmentTime) {
const blockchainInfo = await bitcoinBaseApi.$getBlockchainInfo();
const blockchainInfo = await bitcoinClient.getBlockchainInfo();
if (blockchainInfo.blocks === blockchainInfo.headers) {
const heightDiff = blockHeightTip % 2016;
const blockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff);