You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds two new payment `Method`s for identifying payments with custom
`min_final_cltv_expiry_delta` as payments with LDK or user payment
hashes.
The `min_final_cltv_expiry_delta` value is packed into the first 2
bytes of the expiry timestamp in the payment secret metadata.
Copy file name to clipboardExpand all lines: lightning/src/ln/channelmanager.rs
+31-8Lines changed: 31 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1914,6 +1914,7 @@ where
1914
1914
// final_expiry_too_soon
1915
1915
// We have to have some headroom to broadcast on chain if we have the preimage, so make sure
1916
1916
// we have at least HTLC_FAIL_BACK_BUFFER blocks to go.
1917
+
//
1917
1918
// Also, ensure that, in the case of an unknown preimage for the received payment hash, our
1918
1919
// payment logic has enough time to fail the HTLC backward before our onchain logic triggers a
1919
1920
// channel closure (see HTLC_FAIL_BACK_BUFFER rationale).
@@ -3181,13 +3182,23 @@ where
3181
3182
match claimable_htlc.onion_payload{
3182
3183
OnionPayload::Invoice{ .. } => {
3183
3184
let payment_data = payment_data.unwrap();
3184
-
let payment_preimage = match inbound_payment::verify(payment_hash,&payment_data,self.highest_seen_timestamp.load(Ordering::Acquire)asu64,&self.inbound_payment_key,&self.logger){
3185
-
Ok(payment_preimage) => payment_preimage,
3185
+
let(payment_preimage, min_final_cltv_expiry_delta) = match inbound_payment::verify(payment_hash,&payment_data,self.highest_seen_timestamp.load(Ordering::Acquire)asu64,&self.inbound_payment_key,&self.logger){
3186
+
Ok(result) => result,
3186
3187
Err(()) => {
3188
+
log_trace!(self.logger,"Failing new HTLC with payment_hash {} as payment verification failed", log_bytes!(payment_hash.0));
None => match inbound_payment::verify(payment_hash,&hop_data,0,&expanded_inbound_key,&args.logger){
7372
-
Ok(payment_preimage) => payment_preimage,
7395
+
Ok((payment_preimage, _)) => payment_preimage,
7373
7396
Err(()) => {
7374
7397
log_error!(args.logger,"Failed to read claimable payment data for HTLC with payment hash {} - was not a pending inbound payment and didn't match our payment key", log_bytes!(payment_hash.0));
0 commit comments