Skip to content

doc: Add comments to better explaining the meaning of "recId" for pubkey recovery#3361

Closed
johnzweng wants to merge 1 commit into
bitcoinj:masterfrom
johnzweng:better_comments-for-recId
Closed

doc: Add comments to better explaining the meaning of "recId" for pubkey recovery#3361
johnzweng wants to merge 1 commit into
bitcoinj:masterfrom
johnzweng:better_comments-for-recId

Conversation

@johnzweng

Copy link
Copy Markdown
Contributor

Background

Some time ago I already merged this PR into bitcoinJ where I added the functionality of signing text messages with SegWit addresses.

What I missed back than, was proper documentation of the value recId in the signatures header byte. 🙁

As the meaning of recId is not that obvious I tried to explain it with some added inline documentation.

Description:

  • This PR only adds or changes comments (no code changes)
  • This PR tries to make it better understandable for readers what's the meaning of recId in the header byte of Compact signatures (like used in the signature of bitcoin signed messages)

@msgilligan msgilligan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! I have few minor suggestions, though.

Comment thread core/src/main/java/org/bitcoinj/crypto/ECKey.java Outdated
Comment thread core/src/main/java/org/bitcoinj/crypto/ECKey.java Outdated
Comment thread core/src/main/java/org/bitcoinj/crypto/ECKey.java Outdated
Comment thread core/src/main/java/org/bitcoinj/crypto/ECKey.java Outdated
* Decompress a compressed public key (x co-ord and low-bit of y-coord).
* (if <code>yBit</code> is <code>true</code>, the odd y coordinte will be used,
* if it is <code>false</code> the even y coordinate will be used)
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this is a JavaDoc comment, you could use @param tags to document yBit and add xBN as well.

@johnzweng johnzweng Apr 10, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done: Added the parameters as @param tags, also changed the overall text (existing inconsistent wording, x co-ord vs. y-coord).

And also renamed the parameter name from xBN to xCoordinate. 🙂

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the parameter rename should have gone into a separate PR or commit. Reading your PR description, this PR is about comments, has no code changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, yes, you are totally right. I will remove it again from here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@schildbach Done ✅

Now this PR should only contain comment changes (again). 🙂

@johnzweng johnzweng Apr 10, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Squashed the commits together, now it's one single commit, without code changes.

@johnzweng

Copy link
Copy Markdown
Contributor Author

Thanks @msgilligan for looking over the PR. I changed your suggestions. 🙂 ✅

@johnzweng johnzweng force-pushed the better_comments-for-recId branch from cec14cc to 39a7524 Compare April 10, 2024 08:43
@johnzweng johnzweng requested a review from msgilligan April 10, 2024 10:25
@schildbach

Copy link
Copy Markdown
Member

Merged.

Thanks for improving our documentation! Contributions like this are much appreciated.

@schildbach schildbach closed this Apr 10, 2024
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