From d6733de12d6e9ebb3d9f5a266d05e154a121753a Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 2 Feb 2015 09:21:29 -0300 Subject: [PATCH] add indexes --- lib/model/copayer.js | 7 +------ lib/model/wallet.js | 3 +++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/model/copayer.js b/lib/model/copayer.js index 9596534..0f0abe0 100644 --- a/lib/model/copayer.js +++ b/lib/model/copayer.js @@ -16,9 +16,7 @@ function Copayer(opts) { this.name = opts.name; this.xPubKey = opts.xPubKey; this.xPubKeySignature = opts.xPubKeySignature; // So third parties can check independently - if (opts.xPubKey) { - this.signingPubKey = this.getSigningPubKey(); - } + this.signingPubKey = opts.signingPubKey || this.getSigningPubKey(); }; Copayer.prototype.getSigningPubKey = function () { @@ -29,15 +27,12 @@ Copayer.prototype.getSigningPubKey = function () { Copayer.fromObj = function (obj) { var x = new Copayer(); - x.version = obj.version; x.createdOn = obj.createdOn; x.id = obj.id; x.name = obj.name; x.xPubKey = obj.xPubKey; x.xPubKeySignature = obj.xPubKeySignature; x.signingPubKey = obj.signingPubKey; - - return x; }; diff --git a/lib/model/wallet.js b/lib/model/wallet.js index 56e3592..f09dc48 100644 --- a/lib/model/wallet.js +++ b/lib/model/wallet.js @@ -19,6 +19,9 @@ function Wallet(opts) { this.addressIndex = 0; this.copayers = []; this.pubKey = opts.pubKey; + + this.receiveAddressIndex = 0; + this.changeAddressIndex = 0; }; /* For compressed keys, m*73 + n*34 <= 496 */