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

Expose signable hashes for BOLT 11 and BOLT 12 invoices #2162

Merged
merged 3 commits into from
Apr 7, 2023

Conversation

jkczyz
Copy link
Contributor

@jkczyz jkczyz commented Apr 6, 2023

These are useful for downstream clients needing an invoice identifier. The BOLT 11 invoice hash is already accessible but requires consuming or cloning the invoice first. For BOLT 12, the hash is only used when calculating or verifying a signature, so it is recomputed for simplicity.

@jkczyz jkczyz added this to the 0.0.115 milestone Apr 6, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 6, 2023

Codecov Report

Patch coverage: 66.66% and project coverage change: +1.03 🎉

Comparison is base (48fa2fd) 91.33% compared to head (39befa1) 92.36%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2162      +/-   ##
==========================================
+ Coverage   91.33%   92.36%   +1.03%     
==========================================
  Files         101      103       +2     
  Lines       48837    64849   +16012     
  Branches    48837    64849   +16012     
==========================================
+ Hits        44604    59901   +15297     
- Misses       4233     4948     +715     
Impacted Files Coverage Δ
lightning-invoice/src/lib.rs 83.07% <40.00%> (+2.01%) ⬆️
lightning/src/offers/invoice.rs 89.97% <100.00%> (+0.09%) ⬆️
lightning/src/offers/merkle.rs 100.00% <100.00%> (ø)

... and 49 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

TheBlueMatt
TheBlueMatt previously approved these changes Apr 6, 2023
@@ -1021,6 +1021,11 @@ impl From<PositiveTimestamp> for SystemTime {
}

impl Invoice {
/// The hash of the `RawInvoice` that was signed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: link?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linkified all the the things!

wpaulino
wpaulino previously approved these changes Apr 7, 2023
jkczyz added 3 commits April 6, 2023 23:13
Otherwise, an Invoice must first be converted to a SignedRawInvoice to
obtain the hash.
This is useful as an identifier for downstream clients like VLS.
@jkczyz jkczyz dismissed stale reviews from wpaulino and TheBlueMatt via 39befa1 April 7, 2023 04:16
@jkczyz jkczyz force-pushed the 2023-04-invoice-hash branch from e7b1774 to 39befa1 Compare April 7, 2023 04:16
@wpaulino wpaulino merged commit a5ecb85 into lightningdevkit:main Apr 7, 2023
@jkczyz jkczyz mentioned this pull request May 10, 2023
60 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants