Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve the tracking of loose addresses #91

Merged
merged 2 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/wallet/address-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 15 additions & 4 deletions lib/wallet/wallet-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down