-
Notifications
You must be signed in to change notification settings - Fork 436
invoice: Use PaymentHash in raw invoice types #4363
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
base: main
Are you sure you want to change the base?
invoice: Use PaymentHash in raw invoice types #4363
Conversation
|
👋 I see @valentinewallace was un-assigned. |
da905d6 to
f967d8a
Compare
lightning/src/ln/channelmanager.rs
Outdated
| let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self); | ||
| let payment_hash = invoice.payment_hash(); | ||
| let payment_hash = | ||
| PaymentHash(Sha256::from_byte_array(invoice.payment_hash().0).to_byte_array()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh? Same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. That was a redundant round-trip left over from when I was refactoring the types. Simplified it to just use invoice.payment_hash() directly
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4363 +/- ##
=======================================
Coverage 86.09% 86.09%
=======================================
Files 156 156
Lines 102804 102853 +49
Branches 102804 102853 +49
=======================================
+ Hits 88508 88553 +45
+ Misses 11788 11784 -4
- Partials 2508 2516 +8
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:
|
f967d8a to
6b9f7ec
Compare
6b9f7ec to
59b1623
Compare
Closes #4292
Note: This is a breaking change for InvoiceBuilder. Downstream consumers (like ldk-node) will need to update their builder calls to pass PaymentHash directly.
Refactors
RawBolt11Invoice,RawDataPart, andTaggedFieldto uselightning_types::payment::PaymentHashinstead ofbitcoin::hashes::sha256::Hash.This improves type safety and aligns the raw invoice types with the high-level
Bolt11Invoice.This is a follow-up to #4293 to complete the migration of invoice types to PaymentHash.
Specific changes:
TaggedField::PaymentHashnow holds aPaymentHash.InvoiceBuilder::payment_hashnow accepts aPaymentHashdirectly.serialization.
the TaggedField variant.
lightningcrate (channelmanager andinvoice_utils) to remove redundant hash conversions now that the builder
accepts the strong type.