@@ -235,6 +235,7 @@ pub enum PendingHTLCRouting {
235235 blinded: Option<BlindedForward>,
236236 /// The absolute CLTV of the inbound HTLC
237237 incoming_cltv_expiry: Option<u32>,
238+ hold_htlc: bool,
238239 },
239240 /// An HTLC which should be forwarded on to another Trampoline node.
240241 TrampolineForward {
@@ -4876,14 +4877,15 @@ where
48764877 }
48774878 let funding_txo = chan.funding.get_funding_txo().unwrap();
48784879 let logger = WithChannelContext::from(&self.logger, &chan.context, Some(*payment_hash));
4880+ let hold_htlc = true; // TODO: Take from invoice?
48794881 let send_res = chan.send_htlc_and_commit(htlc_msat, payment_hash.clone(),
48804882 htlc_cltv, HTLCSource::OutboundRoute {
48814883 path: path.clone(),
48824884 session_priv: session_priv.clone(),
48834885 first_hop_htlc_msat: htlc_msat,
48844886 payment_id,
48854887 bolt12_invoice: bolt12_invoice.cloned(),
4886- }, onion_packet, None, &self.fee_estimator, &&logger);
4888+ }, onion_packet, None, hold_htlc, &self.fee_estimator, &&logger);
48874889 match break_channel_entry!(self, peer_state, send_res, chan_entry) {
48884890 Some(monitor_update) => {
48894891 match handle_new_monitor_update!(self, funding_txo, monitor_update, peer_state_lock, peer_state, per_peer_state, chan) {
@@ -6024,6 +6026,7 @@ where
60246026 PendingHTLCRouting::Forward { onion_packet, blinded, incoming_cltv_expiry, .. } => {
60256027 PendingHTLCRouting::Forward {
60266028 onion_packet, blinded, incoming_cltv_expiry, short_channel_id: next_hop_scid,
6029+ hold_htlc: false, // Do not hold intercepted HTLCs.
60276030 }
60286031 },
60296032 _ => unreachable!() // Only `PendingHTLCRouting::Forward`s are intercepted
@@ -6222,6 +6225,9 @@ where
62226225 incoming_accept_underpaying_htlcs,
62236226 next_packet_details_opt.map(|d| d.next_packet_pubkey),
62246227 ) {
6228+ // if let PendingHTLCRouting::Forward { hold_htlc, .. } = info.routing {
6229+ // debug_assert!(hold_htlc, "Expected HTLC to be held");
6230+ // }
62256231 Ok(info) => htlc_forwards.push((info, update_add_htlc.htlc_id)),
62266232 Err(inbound_err) => {
62276233 let failure_type =
@@ -14558,6 +14564,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1455814564 (1, blinded, option),
1455914565 (2, short_channel_id, required),
1456014566 (3, incoming_cltv_expiry, option),
14567+ (4, hold_htlc, (default_value, false))
1456114568 },
1456214569 (1, Receive) => {
1456314570 (0, payment_data, required),
0 commit comments