From 434fdc7a78e9b4a650211955f46b43da3844c20b Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 2 Mar 2016 20:28:22 -0800 Subject: [PATCH] wallet fixes. --- lib/bcoin/wallet.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index b1c01f97..1d8399a1 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -90,7 +90,7 @@ function Wallet(options) { this.id = this.getID(); // Non-alphanumeric IDs will break leveldb sorting. - if (!/^[a-zA-Z0-9]$/.test(this.id)) + if (!/^[a-zA-Z0-9]+$/.test(this.id)) throw new Error('Wallet IDs must be alphanumeric.'); this.addKey(this.accountKey); @@ -323,10 +323,12 @@ Wallet.prototype.createAddress = function createAddress(change) { address = this.deriveChange(this.changeDepth); this.deriveChange(this.changeDepth + this.lookahead); this.changeDepth++; + this.changeAddress = address; } else { address = this.deriveReceive(this.receiveDepth); this.deriveReceive(this.receiveDepth + this.lookahead); this.receiveDepth++; + this.receiveAddress = address; } return address;