more fixes.

This commit is contained in:
Christopher Jeffrey 2016-02-04 02:54:02 -08:00
parent fa22c79dbe
commit 1ee4e556b0
2 changed files with 7 additions and 4 deletions

View File

@ -44,6 +44,7 @@ function Address(options) {
this.m = options.m || 1; this.m = options.m || 1;
this.n = options.n || 1; this.n = options.n || 1;
this.redeem = null; this.redeem = null;
this.multisig = false;
if (this.n > 1) { if (this.n > 1) {
if (this.type !== 'multisig') if (this.type !== 'multisig')
@ -52,6 +53,9 @@ function Address(options) {
this.subtype = 'multisig'; this.subtype = 'multisig';
} }
if (this.type === 'multisig' || this.subtype === 'multisig')
this.multisig = true;
if (network.prefixes[this.type] == null) if (network.prefixes[this.type] == null)
throw new Error('Unknown prefix: ' + this.type); throw new Error('Unknown prefix: ' + this.type);

View File

@ -19,7 +19,7 @@ var network = bcoin.protocol.network;
*/ */
function Wallet(options) { function Wallet(options) {
var i; var key, receiving;
if (!(this instanceof Wallet)) if (!(this instanceof Wallet))
return new Wallet(options); return new Wallet(options);
@ -144,7 +144,7 @@ function Wallet(options) {
|| options.entropy || options.entropy
|| options.passphrase || options.passphrase
|| options.compressed) { || options.compressed) {
options.addresses.push({ options.addresses.unshift({
privateKey: options.privateKey, privateKey: options.privateKey,
publicKey: options.publicKey, publicKey: options.publicKey,
pair: options.pair, pair: options.pair,
@ -164,8 +164,6 @@ function Wallet(options) {
this.loading = true; this.loading = true;
this.lastTs = 0; this.lastTs = 0;
var key, receiving;
// This is a chicken and egg problem for BIP45. Real address keys cannot be // 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 // 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 // this wallet is, the actual address objects will be generated once all
@ -247,6 +245,7 @@ Wallet.prototype.getID = function() {
Wallet.prototype._initAddresses = function() { Wallet.prototype._initAddresses = function() {
var options = this.options; var options = this.options;
var i;
assert(!this._initialized); assert(!this._initialized);
this._initialized = true; this._initialized = true;