Skip to content

Commit

Permalink
Call pool.watchWallet() when the wallet is created
Browse files Browse the repository at this point in the history
Add some debug logging when new addresses are added to be watched.
  • Loading branch information
dworznik committed Mar 14, 2016
1 parent 49581a0 commit a97b7ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/bcoin/pool.js
Expand Up @@ -1320,10 +1320,12 @@ Pool.prototype.watchWallet = function watchWallet(wallet) {
}, this);

wallet.on('add address', wallet._poolOnAdd = function(address) {
utils.debug('Adding address to watch: %s', address.getAddress());
self.watchAddress(address);
});

wallet.on('remove address', wallet._poolOnRemove = function(address) {
utils.debug('Removing address to watch: %s', address.getAddress());
self.unwatchAddress(address);
});
};
Expand Down
2 changes: 1 addition & 1 deletion lib/bcoin/wallet.js
Expand Up @@ -68,7 +68,7 @@ function Wallet(options) {
this.n = options.n || 1;

if(options.pool) {
options.addWallet(this);
options.watchWallet(this);
}

if (this.n > 1)
Expand Down

0 comments on commit a97b7ac

Please sign in to comment.