HDWallet: rename derivePrivate to deriveHardened

This commit is contained in:
Daniel Cousens 2014-06-03 16:14:15 +10:00
parent 29fbbaa58d
commit dca284a131
3 changed files with 5 additions and 5 deletions

View file

@ -273,7 +273,7 @@ HDWallet.prototype.derive = function(index) {
return hd
}
HDWallet.prototype.derivePrivate = function(index) {
HDWallet.prototype.deriveHardened = function(index) {
// Only derives hardened private keys by default
return this.derive(index + HDWallet.HIGHEST_BIT)
}

View file

@ -31,9 +31,9 @@ function Wallet(seed, network) {
seed = seed || new Buffer(rng(32))
masterkey = HDNode.fromSeedBuffer(seed, network)
// HD first-level child derivation method should be private
// HD first-level child derivation method should be hardened
// See https://bitcointalk.org/index.php?topic=405179.msg4415254#msg4415254
accountZero = masterkey.derivePrivate(0)
accountZero = masterkey.deriveHardened(0)
externalAccount = accountZero.derive(0)
internalAccount = accountZero.derive(1)

View file

@ -227,7 +227,7 @@ describe('HDWallet', function() {
f.children.forEach(function(c, i) {
it(c.description + ' from ' + f.master.fingerprint, function() {
if (c.hardened) {
hd = hd.derivePrivate(c.m)
hd = hd.deriveHardened(c.m)
} else {
hd = hd.derive(c.m)
@ -255,7 +255,7 @@ describe('HDWallet', function() {
var parent = HDWallet.fromBase58(f.master.base58)
assert.throws(function() {
parent.derivePrivate(c.m)
parent.deriveHardened(c.m)
}, /Could not derive hardened child key/)
})
})