From 14803d053858bd153f5b5c21f6e8c17f95d1bf7e Mon Sep 17 00:00:00 2001
From: Pablo Martin <caedes@sindominio.net>
Date: Thu, 12 Dec 2013 17:25:29 +0100
Subject: [PATCH] fix check for public key when making a private derivation.

---
 src/bip32.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bip32.js b/src/bip32.js
index 9ce7b7e..8a4dc1c 100644
--- a/src/bip32.js
+++ b/src/bip32.js
@@ -74,7 +74,7 @@ BIP32key.prototype.ckd = function(i) {
     else pub = this.key
 
     if (i >= 2147483648) {
-        if (this.priv) throw new Error("Can't do private derivation on public key!")
+        if (!priv) throw new Error("Can't do private derivation on public key!")
         blob = [0].concat(priv.slice(0,32),util.numToBytes(i,4).reverse())
     }
     else blob = pub.concat(util.numToBytes(i,4).reverse())