Skip to content

descriptor/key: fix master fingerprint when there are none #265

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

Merged
merged 1 commit into from
Nov 12, 2021

Conversation

darosior
Copy link
Contributor

It's clearer to return 0x00000000 if we don't know the origin. This is arguably not an API break since, well, this code path could not be taken without panic'ing before.

@darosior
Copy link
Contributor Author

Hmm, fwiw this is not compatible with Bitcoin Core's behaviour (which the previous code tried to emulate). Is it problematic? I mean both versions are pretty explicit about "there is no parent".

@sanket1729
Copy link
Member

I think we should just stick to how core does it and take the first 4 bytes. My rationale is that we don't want users to rely on master fingerprint being 0's for checking that there is no parent.

@apoelstra
Copy link
Member

Where was the previous panic?

@darosior
Copy link
Contributor Author

darosior commented Sep 8, 2021

In Fingerprint::from which asserts a len of 4 bytes (iirc)

@darosior
Copy link
Contributor Author

darosior commented Sep 8, 2021

FWIW i'll update this soon (tm)

We gave 20 bytes to Fingerprint's From which would then assert the
length is 4.

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
@darosior darosior force-pushed the fix_master_fingerprint branch from 2f6ce75 to 775da51 Compare September 24, 2021 17:36
@darosior
Copy link
Contributor Author

Finally got to update this :)

Copy link
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

ACK 775da51

@apoelstra
Copy link
Member

ACK 775da51

Will leave it to Sanket whether we should go ahead and merge this now.

@sanket1729 sanket1729 merged commit ea7170e into rust-bitcoin:master Nov 12, 2021
@darosior darosior deleted the fix_master_fingerprint branch February 7, 2022 08:59
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.

3 participants