From a4a34f9ae9c5665ee4ae1a21b4a8c9c4f32b459a Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Fri, 24 May 2024 11:44:11 -0500 Subject: [PATCH] Add RecipientOnionFields to ClaimingPayment This will be used to include the same field in Event::PaymentClaimed. --- lightning/src/ln/channelmanager.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 52252baa7..624de614d 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -680,6 +680,7 @@ struct ClaimingPayment { receiver_node_id: PublicKey, htlcs: Vec, sender_intended_value: Option, + onion_fields: Option, } impl_writeable_tlv_based!(ClaimingPayment, { (0, amount_msat, required), @@ -687,6 +688,7 @@ impl_writeable_tlv_based!(ClaimingPayment, { (4, receiver_node_id, required), (5, htlcs, optional_vec), (7, sender_intended_value, option), + (9, onion_fields, option), }); struct ClaimablePayment { @@ -6324,7 +6326,7 @@ where } } - let _claiming_payment = claimable_payments.pending_claiming_payments + let claiming_payment = claimable_payments.pending_claiming_payments .entry(payment_hash) .and_modify(|_| { debug_assert!(false, "Shouldn't get a duplicate pending claim event ever"); @@ -6340,10 +6342,11 @@ where receiver_node_id, htlcs, sender_intended_value, + onion_fields: payment.onion_fields, } }); - if let Some(RecipientOnionFields { ref custom_tlvs, .. }) = payment.onion_fields { + if let Some(RecipientOnionFields { ref custom_tlvs, .. }) = claiming_payment.onion_fields { if !custom_tlvs_known && custom_tlvs.iter().any(|(typ, _)| typ % 2 == 0) { log_info!(self.logger, "Rejecting payment with payment hash {} as we cannot accept payment with unknown even TLVs: {}", &payment_hash, log_iter!(custom_tlvs.iter().map(|(typ, _)| typ).filter(|typ| *typ % 2 == 0))); @@ -6750,6 +6753,7 @@ where receiver_node_id, htlcs, sender_intended_value: sender_intended_total_msat, + onion_fields: _, }) = payment { self.pending_events.lock().unwrap().push_back((events::Event::PaymentClaimed { payment_hash, -- 2.39.5