-
Notifications
You must be signed in to change notification settings - Fork 417
Hold times for successful payments #3801
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?
Conversation
👋 Thanks for assigning @valentinewallace as a reviewer! |
badc803
to
e913312
Compare
e913312
to
69a99b4
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3801 +/- ##
==========================================
- Coverage 88.82% 88.82% -0.01%
==========================================
Files 165 165
Lines 119075 119955 +880
Branches 119075 119955 +880
==========================================
+ Hits 105769 106550 +781
- Misses 10986 11101 +115
+ Partials 2320 2304 -16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
69a99b4
to
1f56e04
Compare
bace463
to
1c64a50
Compare
233cbfc
to
f5668f5
Compare
3aed96e
to
b05cc65
Compare
🔔 1st Reminder Hey @valentinewallace @carlaKC! This PR has been waiting for your review. |
1 similar comment
🔔 1st Reminder Hey @valentinewallace @carlaKC! This PR has been waiting for your review. |
b05cc65
to
cd289da
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.
Have an open question on persistence/restarts but otherwise LGTM pending a second reviewer. check_commits
/ fuzz
need fixing in CI.
lightning/src/ln/payment_tests.rs
Outdated
#[cfg(feature = "std")] | ||
thread::sleep(Duration::from_millis(200)); |
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.
Could use a comment. Tbh, this part is pretty unrelated to the test that it's currently in.
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.
I can create a new single path test for it, would that be better?
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.
SGTM
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.
Added
attribution_data.shift_left(); | ||
}, | ||
Err(()) => { | ||
log_debug!( |
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.
Can you comment that we will hit this as soon as we hit a node that doesn't support the attr failures feature?
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.
Added
let attribution_data = process_fulfill_attribution_data( | ||
None, | ||
&htlc.prev_hop.incoming_packet_shared_secret, | ||
0, |
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.
Can we check for this behavior in the existing test, i.e. the recipient will always set the final hold time to 0?
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.
Added to the test_fulfill_hold_times
@@ -2817,6 +2817,27 @@ fn process_failure_packet( | |||
update_attribution_data(onion_error, shared_secret, hold_time); | |||
} | |||
|
|||
pub(crate) fn process_fulfill_attribution_data( |
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.
Can we add a comment for this method, including that it's for intermediate/final nodes?
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.
Added
lightning/src/ln/onion_utils.rs
Outdated
// Shift attribution data to prepare for processing the next hop. | ||
attribution_data.shift_left(); | ||
} else { | ||
log_debug!( |
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.
Discussed offline, not sure that's adding up for me because we currently persist a bunch of stuff in Channel
, which we shouldn't be doing if we expect attribution data to be None
after restart anyway.
🔔 2nd Reminder Hey @carlaKC! This PR has been waiting for your review. |
cd289da
to
fd4740c
Compare
@@ -2901,6 +2901,8 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f | |||
); | |||
check_added_monitors!(nodes[2], 1); | |||
get_htlc_update_msgs!(nodes[2], node_b_id); | |||
// Note that we don't populate fulfill_msg.attribution_data here, which will lead to hold times being |
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.
Rustfmt 🤷♂️
fd4740c
to
bc46f29
Compare
bc46f29
to
bff580f
Compare
Comments addressed. Pre-rebase diff: https://github.com/lightningdevkit/rust-lightning/compare/cd289da..bc46f299a7ad61fe9e4eabdd614085c7bb2fca5f and a few after-rebase touch ups: https://github.com/lightningdevkit/rust-lightning/compare/bff580f..23f52732a4969d8323b8998717736b6dec3ae1da |
Preparation for reuse of the logic.
Need to store AttributionData as part of the inbound HTLC removal reason so that it can be used in the upstream UpdateFulfillHTLC message.
Necessary to preserve attribution data when the HTLC is in the holding cell.
Adds hold time reporting for the final and intermediate nodes.
c440aed
to
664b471
Compare
let session_priv = if path.has_trampoline_hops() { | ||
let session_priv_hash = | ||
Sha256::hash(&session_priv.secret_bytes()).to_byte_array(); | ||
derived_key = SecretKey::from_slice(&session_priv_hash[..]).unwrap(); |
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.
Directly taking a ref to this only seems to work in newer rust versions.
664b471
to
a69eaef
Compare
AttributionData is needed as part of the outbound HTLC outcome when revoke_and_ack has happened and the AttributionData is decoded to get the hold times for inclusion in the PaymentPathSuccessful event.
Prepare for inspecting hold times in PaymentPathSuccessful.
Hold times are surfaced via the PaymentPathSuccessful event.
a69eaef
to
23f5273
Compare
🔔 3rd Reminder Hey @carlaKC! This PR has been waiting for your review. |
Apply the hold time reporting mechanism as implemented in #2256 to the success case. Spec in lightning/bolts#1044