@@ -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 {
@@ -4879,14 +4880,15 @@ where
48794880 }
48804881 let funding_txo = chan.funding.get_funding_txo().unwrap();
48814882 let logger = WithChannelContext::from(&self.logger, &chan.context, Some(*payment_hash));
4883+ let hold_htlc = true; // TODO: Take from invoice?
48824884 let send_res = chan.send_htlc_and_commit(htlc_msat, payment_hash.clone(),
48834885 htlc_cltv, HTLCSource::OutboundRoute {
48844886 path: path.clone(),
48854887 session_priv: session_priv.clone(),
48864888 first_hop_htlc_msat: htlc_msat,
48874889 payment_id,
48884890 bolt12_invoice: bolt12_invoice.cloned(),
4889- }, onion_packet, None, &self.fee_estimator, &&logger);
4891+ }, onion_packet, None, hold_htlc, &self.fee_estimator, &&logger);
48904892 match break_channel_entry!(self, peer_state, send_res, chan_entry) {
48914893 Some(monitor_update) => {
48924894 match handle_new_monitor_update!(self, funding_txo, monitor_update, peer_state_lock, peer_state, per_peer_state, chan) {
@@ -6027,6 +6029,7 @@ where
60276029 PendingHTLCRouting::Forward { onion_packet, blinded, incoming_cltv_expiry, .. } => {
60286030 PendingHTLCRouting::Forward {
60296031 onion_packet, blinded, incoming_cltv_expiry, short_channel_id: next_hop_scid,
6032+ hold_htlc: false, // Do not hold intercepted HTLCs.
60306033 }
60316034 },
60326035 _ => unreachable!() // Only `PendingHTLCRouting::Forward`s are intercepted
@@ -6225,6 +6228,9 @@ where
62256228 incoming_accept_underpaying_htlcs,
62266229 next_packet_details_opt.map(|d| d.next_packet_pubkey),
62276230 ) {
6231+ // if let PendingHTLCRouting::Forward { hold_htlc, .. } = info.routing {
6232+ // debug_assert!(hold_htlc, "Expected HTLC to be held");
6233+ // }
62286234 Ok(info) => htlc_forwards.push((info, update_add_htlc.htlc_id)),
62296235 Err(inbound_err) => {
62306236 let failure_type =
@@ -14387,6 +14393,7 @@ impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1438714393 (1, blinded, option),
1438814394 (2, short_channel_id, required),
1438914395 (3, incoming_cltv_expiry, option),
14396+ (4, hold_htlc, (default_value, false))
1439014397 },
1439114398 (1, Receive) => {
1439214399 (0, payment_data, required),
0 commit comments