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

Make use of TAG_PUBKEY constants in secp256k1_eckey_pubkey_parse #562

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

Empact
Copy link
Contributor

@Empact Empact commented Oct 9, 2018

This results in more self-documenting code.

Constants defined here:

/** Prefix byte used to tag various encoded curvepoints for specific purposes */
#define SECP256K1_TAG_PUBKEY_EVEN 0x02
#define SECP256K1_TAG_PUBKEY_ODD 0x03
#define SECP256K1_TAG_PUBKEY_UNCOMPRESSED 0x04
#define SECP256K1_TAG_PUBKEY_HYBRID_EVEN 0x06
#define SECP256K1_TAG_PUBKEY_HYBRID_ODD 0x07

This results in more self-documenting code.
@gmaxwell
Copy link
Contributor

gmaxwell commented Feb 21, 2019

Meh. I've never been a fan of replacing simple immediate (near-)single use immutable values with construction-opaque macros. But doing this here makes the code more consistent, so I will defer to the judgement that went into using EVEN and ODD in the surrounding code previously and ACK. I reserve the right to whine about the conversion of other simple constants elsewhere. :P

@gmaxwell gmaxwell merged commit d3cb1f9 into bitcoin-core:master Feb 21, 2019
gmaxwell added a commit that referenced this pull request Feb 21, 2019
…y_parse

d3cb1f9 Make use of TAG_PUBKEY constants in secp256k1_eckey_pubkey_parse (Ben Woosley)

Pull request description:

  This results in more self-documenting code.

  Constants defined here:
  https://github.com/bitcoin-core/secp256k1/blob/1e6f1f5ad5e7f1e3ef79313ec02023902bf8175c/include/secp256k1.h#L175-L180

Tree-SHA512: 2026103c487a5ebdea9a2f5ec2be96d74e38d5b2269b4df11e354bb54aba2925b47c3185f530205019840b00fc3501121acfa5234faf1d095d71777826414f69
@Empact Empact deleted the pubkey-tag branch February 21, 2019 06:54
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.

2 participants