Uh oh!
There was an error while loading. Please reload this page.
Provide the HTLCs that settled a payment. - #2478
Conversation
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@## main #2478 +/- ##
==========================================
- Coverage 90.40% 90.39% -0.02%
==========================================
Files 106 106 Lines 56268 56320 +52 Branches 56268 56320 +52 ==========================================
+ Hits 50868 50908 +40 - Misses 5400 5412 +12
☔ View full report in Codecov by Sentry. |
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.
Uh oh!
There was an error while loading. Please reload this page.
waterson
commented
Aug 8, 2023
@valentinewallace@wpaulino thank you for the reviews! I went ahead and promoted |
wpaulino
commented
Aug 9, 2023
This is probably due to #2319. |
valentinewallace
commented
Aug 10, 2023
This is due to #2062, see PR description for the reasoning behind this value. We probably want to add some more documentation to |
valentinewallace
left a comment
There was a problem hiding this comment.
No blocking feedback!
For test coverage, could we add this diff to functional_test_utils:
diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs
index 39396685f..438dc2f90 100644
--- a/lightning/src/ln/functional_test_utils.rs
+++ b/lightning/src/ln/functional_test_utils.rs
@@ -2253,12 +2253,16 @@ pub fn do_claim_payment_along_route_with_extra_penultimate_hop_fees<'a, 'b, 'c>(
let claim_event = expected_paths[0].last().unwrap().node.get_and_clear_pending_events();
assert_eq!(claim_event.len(), 1);
- match claim_event[0] {
- Event::PaymentClaimed { purpose: PaymentPurpose::SpontaneousPayment(preimage), .. }|
- Event::PaymentClaimed { purpose: PaymentPurpose::InvoicePayment { payment_preimage: Some(preimage), ..}, .. } =>
- assert_eq!(preimage, our_payment_preimage),
- Event::PaymentClaimed { purpose: PaymentPurpose::InvoicePayment { .. }, payment_hash, .. } =>
- assert_eq!(&payment_hash.0, &Sha256::hash(&our_payment_preimage.0)[..]),
+ match &claim_event[0] {
+ Event::PaymentClaimed { purpose: PaymentPurpose::SpontaneousPayment(preimage), htlcs, .. } |
+ Event::PaymentClaimed { purpose: PaymentPurpose::InvoicePayment { payment_preimage: Some(preimage), ..}, htlcs, .. } => {
+ assert_eq!(htlcs.len(), expected_paths.len());
+ assert_eq!(preimage, &our_payment_preimage);
+ },
+ Event::PaymentClaimed { purpose: PaymentPurpose::InvoicePayment { .. }, payment_hash, htlcs, .. } => {
+ assert_eq!(htlcs.len(), expected_paths.len());
+ assert_eq!(&payment_hash.0, &Sha256::hash(&our_payment_preimage.0)[..]);
+ },
_ => panic!(),
}
And also modify an existing (or new) test call to expect_payment_claimed! to check each ClaimedHTLC field explicitly.
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.
TheBlueMatt
left a comment
There was a problem hiding this comment.
Please squash the fixup commit - in general we shouldn't land PRs that have commits in them that fix bugs in the previous commits in the same PR. When you do so, please also line-break the first commit in the PR at 70 chars.
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.
Uh oh!
There was an error while loading. Please reload this page.
9dd402c to
89808b3Compare
TheBlueMatt
left a comment
There was a problem hiding this comment.
Basically LGTM, two minor comments and one nit.
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.
TheBlueMatt
commented
Aug 19, 2023
This LGTM, feel free to squash the fixup commit, I think. |
Creates a new `events::ClaimedHTLC` struct that contains the relevant information about a claimed HTLC; e.g., the channel it arrived on, its ID, the amount of the HTLC, the overall amount of the payment, etc. Adds appropriate serialization support. Adds a `Vec<events::ClaimedHTLC>` to the `ClaimingPayment` structure. Populates this when creating the struct by converting the `payment.htlcs` (which are `ClaimingHTLC` structs) into `event::ClaimedHTLC` structs. This is a straightforward transformation. Adds a `Vec<events::ClaimedHTLC>` to the `events::Event::PaymentClaimed` enum. This is populated directly from the `ClaimingPayment`'s `htlcs` vec. Fixeslightningdevkit#2477.
| } | ||
| impl_writeable_tlv_based!(ClaimedHTLC, { |
There was a problem hiding this comment.
nit: separate with newline, but so nitty feel free to ignore.
| let payment = self.claimable_payments.lock().unwrap().pending_claiming_payments.remove(&payment_hash); | ||
| if let Some(ClaimingPayment { amount_msat, payment_purpose: purpose, receiver_node_id }) = payment { | ||
| if let Some(ClaimingPayment { | ||
| amount_msat, |
There was a problem hiding this comment.
At
least
personally,
I
find
the
rustfmt
comically-vertical
flows
to
be
kinda
hard
to
read
:)
Creates a new
events::ClaimedHTLCstruct that contains the relevant information about a claimed HTLC; e.g., the channel it arrived on, its ID, the amount of the HTLC, the overall amount of the payment, etc. Adds appropriate serialization support.Adds a
Vec<events::ClaimedHTLC>to theClaimingPaymentstructure. Populates this when creating the struct by converting thepayment.htlcs(which areClaimingHTLCstructs) intoevent::ClaimedHTLCstructs. This is a straightforward transformation.Adds a
Vec<events::ClaimedHTLC>to theevents::Event::PaymentClaimedenum. This is populated directly from theClaimingPayment'shtlcsvec.Fixes#2477.