@@ -68,8 +68,8 @@ use crate::ln::inbound_payment;
6868use crate::ln::interactivetxs::InteractiveTxMessageSend;
6969use crate::ln::msgs;
7070use crate::ln::msgs::{
71- BaseMessageHandler, ChannelMessageHandler, CommitmentUpdate, DecodeError, LightningError ,
72- MessageSendEvent,
71+ accountable_into_bool, BaseMessageHandler, ChannelMessageHandler, CommitmentUpdate,
72+ DecodeError, LightningError, MessageSendEvent,
7373};
7474use crate::ln::onion_payment::{
7575 check_incoming_htlc_cltv, create_fwd_pending_htlc_info, create_recv_pending_htlc_info,
@@ -427,6 +427,9 @@ pub struct PendingHTLCInfo {
427427 /// This is used to allow LSPs to take fees as a part of payments, without the sender having to
428428 /// shoulder them.
429429 pub skimmed_fee_msat: Option<u64>,
430+ /// An experimental field indicating whether our node's reputation would be held accountable
431+ /// for the timely resolution of the received HTLC.
432+ pub incoming_accountable: Option<bool>,
430433}
431434
432435#[derive(Clone, Debug)] // See FundedChannel::revoke_and_ack for why, tl;dr: Rust bug
@@ -5077,7 +5080,7 @@ where
50775080 let current_height: u32 = self.best_block.read().unwrap().height;
50785081 create_recv_pending_htlc_info(decoded_hop, shared_secret, msg.payment_hash,
50795082 msg.amount_msat, msg.cltv_expiry, None, allow_underpay, msg.skimmed_fee_msat,
5080- current_height)
5083+ accountable_into_bool(msg.accountable), current_height)
50815084 },
50825085 onion_utils::Hop::Forward { .. } | onion_utils::Hop::BlindedForward { .. } => {
50835086 create_fwd_pending_htlc_info(msg, decoded_hop, shared_secret, next_packet_pubkey_opt)
@@ -7189,6 +7192,7 @@ where
71897192 payment_hash,
71907193 outgoing_amt_msat,
71917194 outgoing_cltv_value,
7195+ incoming_accountable,
71927196 ..
71937197 },
71947198 } = payment;
@@ -7287,6 +7291,7 @@ where
72877291 Some(phantom_shared_secret),
72887292 false,
72897293 None,
7294+ incoming_accountable,
72907295 current_height,
72917296 );
72927297 match create_res {
@@ -15883,6 +15888,7 @@ impl_writeable_tlv_based!(PendingHTLCInfo, {
1588315888 (8, outgoing_cltv_value, required),
1588415889 (9, incoming_amt_msat, option),
1588515890 (10, skimmed_fee_msat, option),
15891+ (11, incoming_accountable, option),
1588615892});
1588715893
1588815894impl Writeable for HTLCFailureMsg {
@@ -19317,7 +19323,7 @@ mod tests {
1931719323 if let Err(crate::ln::channelmanager::InboundHTLCErr { reason, .. }) =
1931819324 create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1931919325 sender_intended_amt_msat - extra_fee_msat - 1, 42, None, true, Some(extra_fee_msat),
19320- current_height)
19326+ None, current_height)
1932119327 {
1932219328 assert_eq!(reason, LocalHTLCFailureReason::FinalIncorrectHTLCAmount);
1932319329 } else { panic!(); }
@@ -19340,7 +19346,7 @@ mod tests {
1934019346 let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1934119347 assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1934219348 sender_intended_amt_msat - extra_fee_msat, 42, None, true, Some(extra_fee_msat),
19343- current_height).is_ok());
19349+ None, current_height).is_ok());
1934419350 }
1934519351
1934619352 #[test]
@@ -19365,7 +19371,7 @@ mod tests {
1936519371 custom_tlvs: Vec::new(),
1936619372 },
1936719373 shared_secret: SharedSecret::from_bytes([0; 32]),
19368- }, [0; 32], PaymentHash([0; 32]), 100, TEST_FINAL_CLTV + 1, None, true, None, current_height);
19374+ }, [0; 32], PaymentHash([0; 32]), 100, TEST_FINAL_CLTV + 1, None, true, None, None, current_height);
1936919375
1937019376 // Should not return an error as this condition:
1937119377 // https://github.com/lightning/bolts/blob/4dcc377209509b13cf89a4b91fde7d478f5b46d8/04-onion-routing.md?plain=1#L334
0 commit comments