From 49581a01a7171ce38cacd6ad1ee1c51d16beaa98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Dw=C3=B3rznik?= Date: Mon, 14 Mar 2016 22:30:17 +1100 Subject: [PATCH] Add the wallet to the pool before the initial key derivation --- lib/bcoin/pool.js | 3 ++- lib/bcoin/wallet.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 9e2bebf9f..ec1f3f7ac 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -1219,13 +1219,14 @@ Pool.prototype.isWatched = function(tx, bloom) { Pool.prototype.addWallet = function addWallet(wallet, callback) { var self = this; + this.watchWallet(wallet); + if (this.loading) return this.once('load', this.addWallet.bind(this, wallet, callback)); if (this.wallets.indexOf(wallet) !== -1) return false; - this.watchWallet(wallet); this.wallets.push(wallet); function search() { diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 07854511a..b3b38632f 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -67,6 +67,10 @@ function Wallet(options) { this.m = options.m || 1; this.n = options.n || 1; + if(options.pool) { + options.addWallet(this); + } + if (this.n > 1) this.type = 'multisig';