From: Jeffrey Czyz Date: Fri, 24 May 2024 16:44:11 +0000 (-0500) Subject: Add RecipientOnionFields to ClaimingPayment X-Git-Tag: v0.0.124-beta~110^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=a4a34f9ae9c5665ee4ae1a21b4a8c9c4f32b459a;p=rust-lightning Add RecipientOnionFields to ClaimingPayment This will be used to include the same field in Event::PaymentClaimed. --- 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,