Uh oh!
There was an error while loading. Please reload this page.
[RFC] move the bolt12 invoice inside HTLCSource::OutboundRoute - #3719
Conversation
👋 I see @wpaulino was un-assigned. |
TheBlueMatt
left a comment
There was a problem hiding this comment.
Yea, this all makes sense I think. Sorry to make you undo some of the previous patch.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ldk-reviews-bot
commented
Apr 14, 2025
👋 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
5c25cafComparevincenzopalazzo
commented
Apr 22, 2025
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 |
ldk-reviews-bot
commented
Apr 22, 2025
✅ Added second reviewer: @wpaulino |
TheBlueMatt
left a comment
There was a problem hiding this comment.
Conceptually looks good, but there's still quite a few FIXMEs left, do you want to address those?
Uh oh!
There was an error while loading. Please reload this page.
ldk-reviews-bot
commented
Apr 24, 2025
🔔 1st Reminder Hey @wpaulino! This PR has been waiting for your review. |
vincenzopalazzo
commented
Apr 25, 2025
Jumping in finishing this tomorrow, sorry for the delay! |
94cadd5 to
19ba769Compare19ba769 to
6af45f9CompareCodecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #3719 +/- ##
==========================================
- Coverage 89.15% 89.12% -0.03%
==========================================
Files 156 157 +1 Lines 123837 124125 +288 Branches 123837 124125 +288 ==========================================
+ Hits 110408 110629 +221 - Misses 10754 10807 +53 - Partials 2675 2689 +14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6af45f9 to
b7ea0deCompareldk-reviews-bot
commented
Apr 28, 2025
🔔 2nd Reminder Hey @TheBlueMatt@wpaulino! This PR has been waiting for your review. |
ldk-reviews-bot
commented
Apr 28, 2025
🔔 1st Reminder Hey @TheBlueMatt@wpaulino! This PR has been waiting for your review. |
wpaulino
left a comment
There was a problem hiding this comment.
Good to squash. Also would prefer a more concise commit message as opposed to just quoting a message from Matt.
Uh oh!
There was an error while loading. Please reload this page.
b7ea0de to
b9a07daCompareUh 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.
Uh oh!
There was an error while loading. Please reload this page.
vincenzopalazzo
commented
Apr 29, 2025
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? |
TheBlueMatt
commented
Apr 29, 2025
I think its best to just not because it violates the Rust API guidelines etc. We shouldn't need to hash the |
edc5f8b to
c50d99cComparevincenzopalazzo
commented
Apr 30, 2025
OK, I looked at the code implementation this morning with a fresh mind, and I think I addressed your concern. Thanks for pointing me in the right direction. |
wpaulino
commented
Apr 30, 2025
It doesn't avoid any clones, but we should have diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs
index ce0538931..4affbc2d6 100644
--- a/lightning/src/ln/outbound_payment.rs+++ b/lightning/src/ln/outbound_payment.rs@@ -1068,7 +1068,7 @@ impl OutboundPayments {
core::mem::drop(outbounds);
let result = self.pay_route_internal(
- &route, payment_hash, &recipient_onion, keysend_preimage, invoice_request, Some(bolt12_invoice), payment_id,+ &route, payment_hash, &recipient_onion, keysend_preimage, invoice_request, Some(&bolt12_invoice), payment_id,
Some(route_params.final_value_msat), &onion_session_privs, node_signer, best_block_height,
&send_payment_along_path
);
@@ -1523,7 +1523,7 @@ impl OutboundPayments {
}
};
let res = self.pay_route_internal(&route, payment_hash, &recipient_onion, keysend_preimage,
- invoice_request.as_ref(), bolt12_invoice, payment_id, Some(total_msat), &onion_session_privs, node_signer,+ invoice_request.as_ref(), bolt12_invoice.as_ref(), payment_id, Some(total_msat), &onion_session_privs, node_signer,
best_block_height, &send_payment_along_path);
log_info!(logger, "Result retrying payment id {}: {:?}", &payment_id, res);
if let Err(e) = res {
@@ -1868,7 +1868,7 @@ impl OutboundPayments {
fn pay_route_internal<NS: Deref, F>(
&self, route: &Route, payment_hash: PaymentHash, recipient_onion: &RecipientOnionFields,
- keysend_preimage: Option<PaymentPreimage>, invoice_request: Option<&InvoiceRequest>, bolt12_invoice: Option<PaidBolt12Invoice>,+ keysend_preimage: Option<PaymentPreimage>, invoice_request: Option<&InvoiceRequest>, bolt12_invoice: Option<&PaidBolt12Invoice>,
payment_id: PaymentId, recv_value_msat: Option<u64>, onion_session_privs: &Vec<[u8; 32]>,
node_signer: &NS, best_block_height: u32, send_payment_along_path: &F
) -> Result<(), PaymentSendFailure>
@@ -1924,7 +1924,7 @@ impl OutboundPayments {
let path_res = send_payment_along_path(SendAlongPathArgs {
path: &path, payment_hash: &payment_hash, recipient_onion, total_value,
cur_height, payment_id, keysend_preimage: &keysend_preimage, invoice_request,
- bolt12_invoice: bolt12_invoice.as_ref(),+ bolt12_invoice,
session_priv_bytes: *session_priv_bytes
});
results.push(path_res);
|
TheBlueMatt
left a comment
There was a problem hiding this comment.
Agree with @wpaulino that that nit might be very marginally nicer, but either way this LGTM.
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>
c50d99c to
d6d1c2fComparevincenzopalazzo
commented
Apr 30, 2025
Done, thanks for the review! |
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