From ee4014a12f1e376077108b2617c35d12280fc95b Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 4 Oct 2016 02:22:20 -0700 Subject: [PATCH] hd: minor fixes. --- lib/hd/private.js | 5 ++--- lib/hd/public.js | 5 ++--- lib/wallet/wallet.js | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/hd/private.js b/lib/hd/private.js index c1898b47..d3a6a605 100644 --- a/lib/hd/private.js +++ b/lib/hd/private.js @@ -7,7 +7,6 @@ 'use strict'; var utils = require('../utils/utils'); -var LRU = require('../utils/lru'); var crypto = require('../crypto/crypto'); var ec = require('../crypto/ec'); var assert = require('assert'); @@ -191,7 +190,7 @@ HDPrivateKey.prototype.destroy = function destroy(pub) { HDPrivateKey.prototype.derive = function derive(index, hardened, cache) { var p, id, data, hash, left, right, key, child; - if (hardened instanceof LRU) { + if (typeof hardened !== 'boolean') { cache = hardened; hardened = false; } @@ -240,7 +239,7 @@ HDPrivateKey.prototype.derive = function derive(index, hardened, cache) { try { key = ec.privateKeyTweakAdd(this.privateKey, left); } catch (e) { - return this.derive(index + 1); + return this.derive(index + 1, cache); } if (!this.fingerPrint) diff --git a/lib/hd/public.js b/lib/hd/public.js index f722f9e2..16d175f8 100644 --- a/lib/hd/public.js +++ b/lib/hd/public.js @@ -7,7 +7,6 @@ 'use strict'; var utils = require('../utils/utils'); -var LRU = require('../utils/lru'); var crypto = require('../crypto/crypto'); var ec = require('../crypto/ec'); var assert = require('assert'); @@ -144,7 +143,7 @@ HDPublicKey.prototype.destroy = function destroy() { HDPublicKey.prototype.derive = function derive(index, hardened, cache) { var p, id, data, hash, left, right, key, child; - if (hardened instanceof LRU) { + if (typeof hardened !== 'boolean') { cache = hardened; hardened = false; } @@ -183,7 +182,7 @@ HDPublicKey.prototype.derive = function derive(index, hardened, cache) { try { key = ec.publicKeyTweakAdd(this.publicKey, left, true); } catch (e) { - return this.derive(index + 1); + return this.derive(index + 1, cache); } if (!this.fingerPrint) diff --git a/lib/wallet/wallet.js b/lib/wallet/wallet.js index f6837690..951b3811 100644 --- a/lib/wallet/wallet.js +++ b/lib/wallet/wallet.js @@ -413,7 +413,6 @@ Wallet.prototype._encrypt = co(function* encrypt(passphrase) { yield this.commit(); }); - /** * Decrypt the wallet permanently. * @param {String|Buffer} passphrase