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;