From 3594360a408b70dc095561a9654002a9cbb6fb8d Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Mon, 21 Oct 2019 15:36:58 +0200 Subject: [PATCH 1/2] foce tracking of paynyms addresses for dojos relying on a local data source --- lib/wallet/wallet-service.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/wallet/wallet-service.js b/lib/wallet/wallet-service.js index 9d1745d..78f75be 100644 --- a/lib/wallet/wallet-service.js +++ b/lib/wallet/wallet-service.js @@ -9,6 +9,9 @@ const Logger = require('../logger') const db = require('../db/mysql-db-wrapper') const hdaService = require('../bitcoin/hd-accounts-service') const hdaHelper = require('../bitcoin/hd-accounts-helper') +const network = require('../bitcoin/network') +const activeNet = network.network +const keys = require('../../keys')[network.key] const WalletInfo = require('./wallet-info') @@ -60,9 +63,13 @@ class WalletService { await db.addAddresses(bip49.addrs) await db.addAddresses(bip84.addrs) await db.addAddresses(pubkeys.addrs) - // Ensure addresses exist and filter them + // Ensure addresses exist await walletInfo.ensureAddresses() - //await this._forceEnsureAddressesForActivePubkeys(active) + // Force import of addresses associated to paynyms + // if dojo relies on a local index + if (keys.indexer.active != 'third_party_explorer') + await this._forceEnsureAddressesForActivePubkeys(active) + // Filter the address and load them await walletInfo.filterAddresses() await walletInfo.loadAddressesInfo() // Load the most recent transactions @@ -136,9 +143,13 @@ class WalletService { await db.addAddresses(bip49.addrs) await db.addAddresses(bip84.addrs) await db.addAddresses(pubkeys.addrs) - // Ensure addresses exist and filter them + // Ensure addresses exist await walletInfo.ensureAddresses() - //await this._forceEnsureAddressesForActivePubkeys(active) + // Force import of addresses associated to paynyms + // if dojo relies on a local index + if (keys.indexer.active != 'third_party_explorer') + await this._forceEnsureAddressesForActivePubkeys(active) + // Filter the addresses await walletInfo.filterAddresses() // Load the utxos await walletInfo.loadUtxos() From 13b99f5597346d802b16dd753ec4462388e2fffe Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Mon, 21 Oct 2019 15:38:12 +0200 Subject: [PATCH 2/2] fix detection of loose addresses in AddressInfo.loadInfoExtended() --- lib/wallet/address-info.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/wallet/address-info.js b/lib/wallet/address-info.js index 53bf15a..c5a22c2 100644 --- a/lib/wallet/address-info.js +++ b/lib/wallet/address-info.js @@ -65,9 +65,12 @@ class AddressInfo { this.path = ['M', info.hdAddrChain, info.hdAddrIndex].join('/') } - if (res.loose.indexOf(this.address) > -1) { - this.tracked = true - this.type = 'loose' + for (let a of res.loose) { + if (a.addrAddress == this.address) { + this.tracked = true + this.type = 'loose' + break + } } return this.loadInfo()