Uh oh!
There was an error while loading. Please reload this page.
Change Bolt11Invoice payment_hash function return type - #4293
Conversation
I've assigned @TheBlueMatt as a reviewer! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #4293 +/- ##
==========================================
- Coverage 89.36% 86.55% -2.82%
==========================================
Files 180 158 -22 Lines 139847 101821 -38026 Branches 139847 101821 -38026 ==========================================
- Hits 124975 88128 -36847 + Misses 12278 11273 -1005 + Partials 2594 2420 -174
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
vincenzopalazzo
left a comment
There was a problem hiding this comment.
I did a pass of this PR, and the git history can be squashed into a single message that includes also a small line for the potential breaking change that this PR is introducing.
In addition, if changing to by-value return is what we want, do you think that we should consider updating payment_secret() as well for consistency (perhaps in a follow-up PR, or expand this one's scope).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@vincenzopalazzo updating |
ldk-reviews-bot
commented
Dec 29, 2025
🔔 1st Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
vincenzopalazzo
commented
Dec 29, 2025
Probably better wait the input from @TheBlueMatt before considering the |
psychemist
commented
Dec 30, 2025
alright. that tracks. i'll make the necessary changes you pointed out |
ldk-reviews-bot
commented
Dec 31, 2025
🔔 2nd Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
ldk-reviews-bot
commented
Jan 3, 2026
🔔 3rd Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
51fc781 to
f3c4954CompareThis commit fixes the payment_hash function of Bolt11Invoice to return a PaymentHash type instead of a sha256 byte stream. Code and test files dependent on this function have also been modified to adhere to the updated changes.
f3c4954 to
9c802c2Compareldk-reviews-bot
commented
Jan 5, 2026
🔔 4th Reminder Hey @TheBlueMatt! This PR has been waiting for your review. |
| /// Returns the hash to which we will receive the preimage on completion of the payment | ||
| pub fn payment_hash(&self) -> &sha256::Hash { | ||
| &self.signed_invoice.payment_hash().expect("checked by constructor").0 | ||
| pub fn payment_hash(&self) -> PaymentHash { |
There was a problem hiding this comment.
Please change the field on the raw invoices as well and in TaggedField.
TheBlueMatt
left a comment
There was a problem hiding this comment.
Gonna go ahead and land this. It would be nice to also update the types in the raw invoice but this is better than it was.
This change updates
Bolt11Invoice'spayment_hashfunction's return type from a stream of bytes (sha256 digest) toPaymentHash, which is now a valid type inlightning_types. Also, tests and other functions that called the function were refactored to reflect that modification.Closes#4292