Browse Source

Merge pull request #91 from Samourai-Wallet/fix_force_import_bip47_addr

improve the tracking of loose addresses
umbrel
kenshin samourai 5 years ago
committed by GitHub
parent
commit
c08e183833
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      lib/wallet/address-info.js
  2. 19
      lib/wallet/wallet-service.js

5
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) {
for (let a of res.loose) {
if (a.addrAddress == this.address) {
this.tracked = true
this.type = 'loose'
break
}
}
return this.loadInfo()

19
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()

Loading…
Cancel
Save