@@ -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: bool,
430433}
431434
432435#[derive(Clone, Debug)] // See FundedChannel::revoke_and_ack for why, tl;dr: Rust bug
@@ -5249,7 +5252,7 @@ where
52495252 let current_height: u32 = self.best_block.read().unwrap().height;
52505253 create_recv_pending_htlc_info(decoded_hop, shared_secret, msg.payment_hash,
52515254 msg.amount_msat, msg.cltv_expiry, None, allow_underpay, msg.skimmed_fee_msat,
5252- current_height)
5255+ msg.accountable.unwrap_or(false), current_height)
52535256 },
52545257 onion_utils::Hop::Forward { .. } | onion_utils::Hop::BlindedForward { .. } => {
52555258 create_fwd_pending_htlc_info(msg, decoded_hop, shared_secret, next_packet_pubkey_opt)
@@ -7375,6 +7378,7 @@ where
73757378 payment_hash,
73767379 outgoing_amt_msat,
73777380 outgoing_cltv_value,
7381+ incoming_accountable,
73787382 ..
73797383 },
73807384 } = payment;
@@ -7473,6 +7477,7 @@ where
74737477 Some(phantom_shared_secret),
74747478 false,
74757479 None,
7480+ incoming_accountable,
74767481 current_height,
74777482 );
74787483 match create_res {
@@ -16248,6 +16253,7 @@ impl_writeable_tlv_based!(PendingHTLCInfo, {
1624816253 (8, outgoing_cltv_value, required),
1624916254 (9, incoming_amt_msat, option),
1625016255 (10, skimmed_fee_msat, option),
16256+ (11, incoming_accountable, (default_value, false)),
1625116257});
1625216258
1625316259impl Writeable for HTLCFailureMsg {
@@ -19837,7 +19843,7 @@ mod tests {
1983719843 if let Err(crate::ln::channelmanager::InboundHTLCErr { reason, .. }) =
1983819844 create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1983919845 sender_intended_amt_msat - extra_fee_msat - 1, 42, None, true, Some(extra_fee_msat),
19840- current_height)
19846+ false, current_height)
1984119847 {
1984219848 assert_eq!(reason, LocalHTLCFailureReason::FinalIncorrectHTLCAmount);
1984319849 } else { panic!(); }
@@ -19860,7 +19866,7 @@ mod tests {
1986019866 let current_height: u32 = node[0].node.best_block.read().unwrap().height;
1986119867 assert!(create_recv_pending_htlc_info(hop_data, [0; 32], PaymentHash([0; 32]),
1986219868 sender_intended_amt_msat - extra_fee_msat, 42, None, true, Some(extra_fee_msat),
19863- current_height).is_ok());
19869+ false, current_height).is_ok());
1986419870 }
1986519871
1986619872 #[test]
@@ -19885,7 +19891,7 @@ mod tests {
1988519891 custom_tlvs: Vec::new(),
1988619892 },
1988719893 shared_secret: SharedSecret::from_bytes([0; 32]),
19888- }, [0; 32], PaymentHash([0; 32]), 100, TEST_FINAL_CLTV + 1, None, true, None, current_height);
19894+ }, [0; 32], PaymentHash([0; 32]), 100, TEST_FINAL_CLTV + 1, None, true, None, false, current_height);
1988919895
1989019896 // Should not return an error as this condition:
1989119897 // https://github.com/lightning/bolts/blob/4dcc377209509b13cf89a4b91fde7d478f5b46d8/04-onion-routing.md?plain=1#L334
0 commit comments