@@ -426,6 +426,9 @@ pub struct PendingHTLCInfo {
426426 /// This is used to allow LSPs to take fees as a part of payments, without the sender having to
427427 /// shoulder them.
428428 pub skimmed_fee_msat: Option<u64>,
429+ /// An experimental field indicating whether our node's reputation would be held accountable
430+ /// for the timely resolution of the received HTLC.
431+ pub incoming_accountable: Option<u8>,
429432}
430433
431434#[derive(Clone)] // See FundedChannel::revoke_and_ack for why, tl;dr: Rust bug
@@ -5048,7 +5051,7 @@ where
50485051 let current_height: u32 = self.best_block.read().unwrap().height;
50495052 create_recv_pending_htlc_info(decoded_hop, shared_secret, msg.payment_hash,
50505053 msg.amount_msat, msg.cltv_expiry, None, allow_underpay, msg.skimmed_fee_msat,
5051- current_height)
5054+ msg.accountable, current_height)
50525055 },
50535056 onion_utils::Hop::Forward { .. } | onion_utils::Hop::BlindedForward { .. } => {
50545057 create_fwd_pending_htlc_info(msg, decoded_hop, shared_secret, next_packet_pubkey_opt)
@@ -7150,6 +7153,7 @@ where
71507153 payment_hash,
71517154 outgoing_amt_msat,
71527155 outgoing_cltv_value,
7156+ incoming_accountable,
71537157 ..
71547158 },
71557159 } = payment;
@@ -7248,6 +7252,7 @@ where
72487252 Some(phantom_shared_secret),
72497253 false,
72507254 None,
7255+ incoming_accountable,
72517256 current_height,
72527257 );
72537258 match create_res {
@@ -15764,6 +15769,7 @@ impl_writeable_tlv_based!(PendingHTLCInfo, {
1576415769 (8, outgoing_cltv_value, required),
1576515770 (9, incoming_amt_msat, option),
1576615771 (10, skimmed_fee_msat, option),
15772+ (11, incoming_accountable, option),
1576715773});
1576815774
1576915775impl Writeable for HTLCFailureMsg {
@@ -19198,7 +19204,7 @@ mod tests {
1919819204 if let Err(crate::ln::channelmanager::InboundHTLCErr { reason, .. }) =
1919919205 create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1920019206 sender_intended_amt_msat - extra_fee_msat - 1, 42, None, true, Some(extra_fee_msat),
19201- current_height)
19207+ None, current_height)
1920219208 {
1920319209 assert_eq!(reason, LocalHTLCFailureReason::FinalIncorrectHTLCAmount);
1920419210 } else { panic!(); }
@@ -19221,7 +19227,7 @@ mod tests {
1922119227 let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1922219228 assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1922319229 sender_intended_amt_msat - extra_fee_msat, 42, None, true, Some(extra_fee_msat),
19224- current_height).is_ok());
19230+ None, current_height).is_ok());
1922519231 }
1922619232
1922719233 #[test]
@@ -19246,7 +19252,7 @@ mod tests {
1924619252 custom_tlvs: Vec::new(),
1924719253 },
1924819254 shared_secret: SharedSecret::from_bytes([0; 32]),
19249- }, [0; 32], PaymentHash([0; 32]), 100, TEST_FINAL_CLTV + 1, None, true, None, current_height);
19255+ }, [0; 32], PaymentHash([0; 32]), 100, TEST_FINAL_CLTV + 1, None, true, None, None, current_height);
1925019256
1925119257 // Should not return an error as this condition:
1925219258 // https://github.com/lightning/bolts/blob/4dcc377209509b13cf89a4b91fde7d478f5b46d8/04-onion-routing.md?plain=1#L334
0 commit comments