diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 74866cb4..c52f31b9 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -351,7 +351,6 @@ Wallet.prototype.deriveChange = function deriveChange(index) { }; Wallet.prototype.deriveAddress = function deriveAddress(change, index) { - var self = this; var path, data, key, options, address; assert(this._initialized); @@ -445,7 +444,8 @@ Wallet.prototype.parsePath = function parsePath(path) { Wallet.prototype.setReceiveDepth = function setReceiveDepth(depth) { var i; - assert(this.derivation !== 'normal'); + if (depth <= this.receiveDepth) + return false; for (i = this.receiveDepth; i < depth; i++) this.receiveAddress = this.deriveReceive(i); @@ -454,12 +454,15 @@ Wallet.prototype.setReceiveDepth = function setReceiveDepth(depth) { this.deriveReceive(i); this.receiveDepth = depth; + + return true; }; Wallet.prototype.setChangeDepth = function setChangeDepth(depth) { var i; - assert(this.derivation !== 'normal'); + if (depth <= this.changeDepth) + return false; for (i = this.changeDepth; i < depth; i++) this.changeAddress = this.deriveChange(i); @@ -468,6 +471,8 @@ Wallet.prototype.setChangeDepth = function setChangeDepth(depth) { this.deriveChange(i); this.changeDepth = depth; + + return true; }; Wallet.prototype.getPrivateKey = function getPrivateKey(enc) {