@@ -425,6 +425,7 @@ struct OutboundHTLCOutput {
425425 blinding_point: Option<PublicKey>,
426426 skimmed_fee_msat: Option<u64>,
427427 send_timestamp: Option<Duration>,
428+ hold_htlc: bool,
428429}
429430
430431impl OutboundHTLCOutput {
@@ -459,6 +460,7 @@ enum HTLCUpdateAwaitingACK {
459460 // The extra fee we're skimming off the top of this HTLC.
460461 skimmed_fee_msat: Option<u64>,
461462 blinding_point: Option<PublicKey>,
463+ hold_htlc: bool,
462464 },
463465 ClaimHTLC {
464466 payment_preimage: PaymentPreimage,
@@ -7231,6 +7233,7 @@ where
72317233 ref onion_routing_packet,
72327234 skimmed_fee_msat,
72337235 blinding_point,
7236+ hold_htlc,
72347237 ..
72357238 } => {
72367239 match self.send_htlc(
@@ -7242,6 +7245,7 @@ where
72427245 false,
72437246 skimmed_fee_msat,
72447247 blinding_point,
7248+ hold_htlc,
72457249 fee_estimator,
72467250 logger,
72477251 ) {
@@ -8362,6 +8366,7 @@ where
83628366 onion_routing_packet: (**onion_packet).clone(),
83638367 skimmed_fee_msat: htlc.skimmed_fee_msat,
83648368 blinding_point: htlc.blinding_point,
8369+ hold_htlc: htlc.hold_htlc.then(|| ()),
83658370 });
83668371 }
83678372 }
@@ -10586,7 +10591,8 @@ where
1058610591 pub fn queue_add_htlc<F: Deref, L: Deref>(
1058710592 &mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
1058810593 source: HTLCSource, onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
10589- blinding_point: Option<PublicKey>, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
10594+ hold_htlc: bool, blinding_point: Option<PublicKey>,
10595+ fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
1059010596 ) -> Result<(), (LocalHTLCFailureReason, String)>
1059110597 where
1059210598 F::Target: FeeEstimator,
@@ -10601,6 +10607,7 @@ where
1060110607 true,
1060210608 skimmed_fee_msat,
1060310609 blinding_point,
10610+ hold_htlc,
1060410611 fee_estimator,
1060510612 logger,
1060610613 )
@@ -10631,7 +10638,7 @@ where
1063110638 fn send_htlc<F: Deref, L: Deref>(
1063210639 &mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
1063310640 source: HTLCSource, onion_routing_packet: msgs::OnionPacket, mut force_holding_cell: bool,
10634- skimmed_fee_msat: Option<u64>, blinding_point: Option<PublicKey>,
10641+ skimmed_fee_msat: Option<u64>, blinding_point: Option<PublicKey>, hold_htlc: bool,
1063510642 fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
1063610643 ) -> Result<bool, (LocalHTLCFailureReason, String)>
1063710644 where
@@ -10713,6 +10720,7 @@ where
1071310720 onion_routing_packet,
1071410721 skimmed_fee_msat,
1071510722 blinding_point,
10723+ hold_htlc,
1071610724 });
1071710725 return Ok(false);
1071810726 }
@@ -10734,6 +10742,7 @@ where
1073410742 blinding_point,
1073510743 skimmed_fee_msat,
1073610744 send_timestamp,
10745+ hold_htlc,
1073710746 });
1073810747 self.context.next_holder_htlc_id += 1;
1073910748
@@ -10977,7 +10986,7 @@ where
1097710986 pub fn send_htlc_and_commit<F: Deref, L: Deref>(
1097810987 &mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
1097910988 source: HTLCSource, onion_routing_packet: msgs::OnionPacket, skimmed_fee_msat: Option<u64>,
10980- fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
10989+ hold_htlc: bool, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
1098110990 ) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
1098210991 where
1098310992 F::Target: FeeEstimator,
@@ -10992,6 +11001,7 @@ where
1099211001 false,
1099311002 skimmed_fee_msat,
1099411003 None,
11004+ hold_htlc,
1099511005 fee_estimator,
1099611006 logger,
1099711007 );
@@ -12629,6 +12639,7 @@ where
1262912639 ref onion_routing_packet,
1263012640 blinding_point,
1263112641 skimmed_fee_msat,
12642+ ..
1263212643 } => {
1263312644 0u8.write(writer)?;
1263412645 amount_msat.write(writer)?;
@@ -13032,6 +13043,7 @@ where
1303213043 skimmed_fee_msat: None,
1303313044 blinding_point: None,
1303413045 send_timestamp: None,
13046+ hold_htlc: false, // TODO: Persistence
1303513047 });
1303613048 }
1303713049
@@ -13050,6 +13062,7 @@ where
1305013062 onion_routing_packet: Readable::read(reader)?,
1305113063 skimmed_fee_msat: None,
1305213064 blinding_point: None,
13065+ hold_htlc: false, // TODO: Persistence
1305313066 },
1305413067 1 => HTLCUpdateAwaitingACK::ClaimHTLC {
1305513068 payment_preimage: Readable::read(reader)?,
@@ -13944,6 +13957,7 @@ mod tests {
1394413957 skimmed_fee_msat: None,
1394513958 blinding_point: None,
1394613959 send_timestamp: None,
13960+ hold_htlc: false,
1394713961 });
1394813962
1394913963 // Make sure when Node A calculates their local commitment transaction, none of the HTLCs pass
@@ -14398,6 +14412,7 @@ mod tests {
1439814412 skimmed_fee_msat: None,
1439914413 blinding_point: None,
1440014414 send_timestamp: None,
14415+ hold_htlc: false,
1440114416 };
1440214417 let mut pending_outbound_htlcs = vec![dummy_outbound_output.clone(); 10];
1440314418 for (idx, htlc) in pending_outbound_htlcs.iter_mut().enumerate() {
@@ -14423,6 +14438,7 @@ mod tests {
1442314438 },
1442414439 skimmed_fee_msat: None,
1442514440 blinding_point: None,
14441+ hold_htlc: false,
1442614442 };
1442714443 let dummy_holding_cell_claim_htlc = |attribution_data| HTLCUpdateAwaitingACK::ClaimHTLC {
1442814444 payment_preimage: PaymentPreimage([42; 32]),
0 commit comments