-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding function to decide if HDNode is private #536
Conversation
Nice! Maybe That way a scenario could play out as: if (!node.isNeutered()) node = node.neutered() |
Also, are you up to add some tests? 👍 |
Hm. On one hand, it makes sense, because it's consistent, on the other hand I just wouldn't guess from the name what it means. I will look more into the travis failures (seems like style issue... that's what I get for editing code in github GUI :)) |
@@ -281,6 +281,10 @@ HDNode.prototype.deriveHardened = function (index) { | |||
return this.derive(index + HDNode.HIGHEST_BIT) | |||
} | |||
|
|||
HDNode.prototype.isPrivate = function () { | |||
return !!(this.keyPair.d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra semicolon
I wouldn't be opposed to having both then I guess? Its just more to maintain and think about. @fanatid thoughts? |
In any case @Runn1ng, please add tests in lieu of the naming bike shed. |
Since |
I have renamed the function and removed the semicolon. Now I am adding tests |
Public === neutered. Private === not neutered
To test removing private information, it's probably better to start with them :)
I have added some tests. Is it OK like this? |
...stupid semicolons! :D ok now? |
....the test failure is timeout failure and not related to my changes (I think). |
@@ -240,7 +242,7 @@ describe('HDNode', function () { | |||
var f = fixtures.valid[0] | |||
|
|||
it('strips all private information', function () { | |||
var hd = HDNode.fromBase58(f.master.base58, NETWORKS_LIST) | |||
var hd = HDNode.fromBase58(f.master.base58Priv, NETWORKS_LIST) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha. Good catch.
Sorry for the screw around @Runn1ng... 👍 |
Bugger it actually, thanks @Runn1ng 👍 If |
Adding function to decide if HDNode is private
Won't publish for a little while yet, will be in |
It's a very simple function that probably isn't that important, but can help someone.
If you like this idea, I will add some tests for that