hdnode: add deprecation message for isPrivate

This commit is contained in:
Daniel Cousens 2014-07-30 18:00:20 +10:00
parent 2fbd9449f5
commit 6b429493f8
2 changed files with 16 additions and 7 deletions

View file

@ -157,7 +157,13 @@ HDNode.prototype.toBase58 = function(isPrivate) {
}
HDNode.prototype.toBuffer = function(isPrivate) {
if (isPrivate == undefined) isPrivate = !!this.privKey
if (isPrivate == undefined) {
isPrivate = !!this.privKey
// FIXME: remove in 2.x.y
} else {
console.warn('isPrivate flag is deprecated, please use the .neutered() method instead')
}
// Version
var version = isPrivate ? this.network.bip32.private : this.network.bip32.public
@ -183,6 +189,7 @@ HDNode.prototype.toBuffer = function(isPrivate) {
// 33 bytes: the public key or private key data
if (isPrivate) {
// FIXME: remove in 2.x.y
assert(this.privKey, 'Missing private key')
// 0x00 + k for private keys