From 1ee4e556b00073f110e903d80b18f7360896d7ea Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 4 Feb 2016 02:54:02 -0800 Subject: [PATCH] more fixes. --- lib/bcoin/address.js | 4 ++++ lib/bcoin/wallet.js | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/bcoin/address.js b/lib/bcoin/address.js index c917e9b3..71ea239d 100644 --- a/lib/bcoin/address.js +++ b/lib/bcoin/address.js @@ -44,6 +44,7 @@ function Address(options) { this.m = options.m || 1; this.n = options.n || 1; this.redeem = null; + this.multisig = false; if (this.n > 1) { if (this.type !== 'multisig') @@ -52,6 +53,9 @@ function Address(options) { this.subtype = 'multisig'; } + if (this.type === 'multisig' || this.subtype === 'multisig') + this.multisig = true; + if (network.prefixes[this.type] == null) throw new Error('Unknown prefix: ' + this.type); diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index c2a180f4..05804627 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -19,7 +19,7 @@ var network = bcoin.protocol.network; */ function Wallet(options) { - var i; + var key, receiving; if (!(this instanceof Wallet)) return new Wallet(options); @@ -144,7 +144,7 @@ function Wallet(options) { || options.entropy || options.passphrase || options.compressed) { - options.addresses.push({ + options.addresses.unshift({ privateKey: options.privateKey, publicKey: options.publicKey, pair: options.pair, @@ -164,8 +164,6 @@ function Wallet(options) { this.loading = true; this.lastTs = 0; - var key, receiving; - // This is a chicken and egg problem for BIP45. Real address keys cannot be // generated until all shared keys have been added to the wallet. The flow of // this wallet is, the actual address objects will be generated once all @@ -247,6 +245,7 @@ Wallet.prototype.getID = function() { Wallet.prototype._initAddresses = function() { var options = this.options; + var i; assert(!this._initialized); this._initialized = true;