Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

benma
Copy link
Contributor

@benma benma commented Oct 28, 2018

No way to access them otherwise. Handy for interoperability.

hdkeychain/extendedkey.go Outdated Show resolved Hide resolved
hdkeychain/extendedkey.go Outdated Show resolved Hide resolved
Copy link
Contributor

@onyb onyb left a 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)
Copy link
Contributor

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.

Suggested change
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as with ChildNum().

Suggested change
test.name, chainCode, test.chainCode)
test.name, test.chainCode, chainCode)

Copy link
Contributor

@onyb onyb left a 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 {
Copy link
Member

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.

@jcvernaleo
Copy link
Member

Closing since we merged new version of it.

@jcvernaleo jcvernaleo closed this Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants