-
Notifications
You must be signed in to change notification settings - Fork 402
[RFC] move the bolt12 invoice inside HTLCSource::OutboundRoute #3719
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?
[RFC] move the bolt12 invoice inside HTLCSource::OutboundRoute #3719
Conversation
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
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.
Yea, this all makes sense I think. Sorry to make you undo some of the previous patch.
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
637983d
to
5c25caf
Compare
Thanks Matt! I rebased on the main to fix the commit checks and addressed some of the review comments. We should be good for another round |
✅ Added second reviewer: @wpaulino |
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.
Conceptually looks good, but there's still quite a few FIXMEs left, do you want to address those?
🔔 1st Reminder Hey @wpaulino! This PR has been waiting for your review. |
Jumping in finishing this tomorrow, sorry for the delay! |
94cadd5
to
19ba769
Compare
19ba769
to
6af45f9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3719 +/- ##
==========================================
- Coverage 89.15% 89.11% -0.05%
==========================================
Files 156 157 +1
Lines 123837 124017 +180
Branches 123837 124017 +180
==========================================
+ Hits 110408 110515 +107
- Misses 10754 10812 +58
- Partials 2675 2690 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6af45f9
to
b7ea0de
Compare
🔔 2nd Reminder Hey @TheBlueMatt @wpaulino! This PR has been waiting for your review. |
🔔 1st Reminder Hey @TheBlueMatt @wpaulino! This PR has been waiting for your review. |
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.
Good to squash. Also would prefer a more concise commit message as opposed to just quoting a message from Matt.
read_tlv_fields!(reader, { | ||
(0, session_priv, required), | ||
(1, payment_id, option), | ||
(2, first_hop_htlc_msat, required), | ||
(4, path_hops, required_vec), | ||
(5, payment_params, (option: ReadableArgs, 0)), | ||
(6, blinded_tail, option), | ||
(7, bolt12_invoice, option), |
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.
Should this be even to guarantee that users will receive the invoice in the PaymentSent
event?
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.
This is a good point, and I do not remember if this was discussed with some other review in the past with @TheBlueMat, but I am fine with the idea to make it mandatory and set to None
id the value is not specified.
I was missing the case that you described, the reason that It is not event is for backwards compatibility but I guess None
guarantee the same things
It moves the PaidBolt12Invoice (BOLT 12 invoice) into HTLCSource::OutboundRoute to ensure the invoice is available for proof-of-payment and event emission, as discussed in issue lightningdevkit#3714. The commit also updates hashing implementations and derives to ensure correct behavior when the invoice is present, and propagates the invoice through relevant payment and event structures. This fixes a potential issue where the invoice could be lost on restart, affecting PoP reliability. Link: lightningdevkit#3714 Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
b7ea0de
to
b9a07da
Compare
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.
A few nits.
@@ -263,6 +263,13 @@ pub(super) struct MetadataMaterial { | |||
encrypted_payment_id: Option<[u8; PaymentId::LENGTH]>, | |||
} | |||
|
|||
impl core::hash::Hash for MetadataMaterial { |
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.
You can drop this (sadly I think we'd need to find a way to hash the hmac
if we kept it, which would be annoying) if...
@@ -57,7 +57,7 @@ const ASYNC_PAYMENTS_HELD_HTLC_HMAC_INPUT: &[u8; 16] = &[9; 16]; | |||
|
|||
/// Message metadata which possibly is derived from [`MetadataMaterial`] such that it can be | |||
/// verified. | |||
#[derive(Clone)] | |||
#[derive(Clone, Hash)] |
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.
You can drop this if...
/// The contents of a [`StaticInvoice`] for responding to an [`Offer`]. | ||
/// | ||
/// [`Offer`]: crate::offers::offer::Offer | ||
#[derive(Clone, Debug)] | ||
#[derive(Clone, Debug, Hash)] |
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.
You drop this.
Mh! ok I am trying to go back to this @TheBlueMatt #3719 (comment) Do you think that having the invoice will bring any benefit for the has function inside the In addition, we would like to keep the odd value in here or changing this to even? |
I think its best to just not because it violates the Rust API guidelines etc. We shouldn't need to hash the |
Matt noted during the last round of review the following:
This commit is trying to store the PaidBolt12Invoice inside the HTLCSource::OutboundRoute, but this is not enough because we have to store the invoice also inside the PendingOutboundPayment.
Fixes: #3714