hd: minor fixes.
This commit is contained in:
parent
08c7136ef4
commit
ee4014a12f
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -413,7 +413,6 @@ Wallet.prototype._encrypt = co(function* encrypt(passphrase) {
|
||||
yield this.commit();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Decrypt the wallet permanently.
|
||||
* @param {String|Buffer} passphrase
|
||||
|
||||
Loading…
Reference in New Issue
Block a user