-
Notifications
You must be signed in to change notification settings - Fork 406
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
hdkeychain: extend API with ChainCode(), ChildNum() #130
Conversation
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.
I added some suggestions to improve the method docs. LGTM otherwise. 👌
No way to access them otherwise. Handy for interoperability.
childNum := key.ChildNum() | ||
if childNum != test.childNum { | ||
t.Errorf("ChildNum #%d (%s): want %d, got %d", i, | ||
test.name, childNum, test.childNum) |
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.
It seems the "want" and "got" are flipped.
test.name, childNum, test.childNum) | |
test.name, test.childNum, childNum) |
chainCode := key.ChainCode() | ||
if !bytes.Equal(chainCode, test.chainCode) { | ||
t.Errorf("ChainCode #%d (%s): want %v, got %v", i, | ||
test.name, chainCode, test.chainCode) |
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.
Same as with ChildNum()
.
test.name, chainCode, test.chainCode) | |
test.name, test.chainCode, chainCode) |
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.
@benma This PR is good to merge, but awaiting minor changes.
// ChainCode returns the chain code part of this extended key. | ||
// | ||
// It is identical for both public and private extended keys. | ||
func (k *ExtendedKey) ChainCode() []byte { |
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.
With #171 merged, we can reduce this PR to just adding the chain code.
Closing since we merged new version of it. |
No way to access them otherwise. Handy for interoperability.