From acf08f333217a50f250978d3698e47baf76becfa Mon Sep 17 00:00:00 2001 From: Overtorment Date: Sun, 31 Mar 2019 00:20:18 +0000 Subject: [PATCH] REF: HD electrum --- class/abstract-hd-wallet.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/class/abstract-hd-wallet.js b/class/abstract-hd-wallet.js index 0b39a3042..2c7aad1df 100644 --- a/class/abstract-hd-wallet.js +++ b/class/abstract-hd-wallet.js @@ -1,6 +1,5 @@ import { LegacyWallet } from './legacy-wallet'; import Frisbee from 'frisbee'; -import { WatchOnlyWallet } from './watch-only-wallet'; const bip39 = require('bip39'); const BigNumber = require('bignumber.js'); const bitcoin = require('bitcoinjs-lib'); @@ -115,12 +114,10 @@ export class AbstractHDWallet extends LegacyWallet { if (this.next_free_address_index + c < 0) continue; let address = this._getExternalAddressByIndex(this.next_free_address_index + c); this.external_addresses_cache[this.next_free_address_index + c] = address; // updating cache just for any case - let WatchWallet = new WatchOnlyWallet(); - WatchWallet.setSecret(address); - await WatchWallet.fetchTransactions(); - if (WatchWallet.transactions.length === 0) { + let txs = await BlueElectrum.getTransactionsByAddress(address); + if (txs.length === 0) { // found free address - freeAddress = WatchWallet.getAddress(); + freeAddress = address; this.next_free_address_index += c; // now points to _this one_ break; } @@ -150,12 +147,10 @@ export class AbstractHDWallet extends LegacyWallet { if (this.next_free_change_address_index + c < 0) continue; let address = this._getInternalAddressByIndex(this.next_free_change_address_index + c); this.internal_addresses_cache[this.next_free_change_address_index + c] = address; // updating cache just for any case - let WatchWallet = new WatchOnlyWallet(); - WatchWallet.setSecret(address); - await WatchWallet.fetchTransactions(); - if (WatchWallet.transactions.length === 0) { + let txs = await BlueElectrum.getTransactionsByAddress(address); + if (txs.length === 0) { // found free address - freeAddress = WatchWallet.getAddress(); + freeAddress = address; this.next_free_change_address_index += c; // now points to _this one_ break; }