@@ -425,6 +425,7 @@ struct OutboundHTLCOutput {
425
425
blinding_point: Option<PublicKey>,
426
426
skimmed_fee_msat: Option<u64>,
427
427
send_timestamp: Option<Duration>,
428
+ hold_htlc: bool,
428
429
}
429
430
430
431
impl OutboundHTLCOutput {
@@ -459,6 +460,7 @@ enum HTLCUpdateAwaitingACK {
459
460
// The extra fee we're skimming off the top of this HTLC.
460
461
skimmed_fee_msat: Option<u64>,
461
462
blinding_point: Option<PublicKey>,
463
+ hold_htlc: bool,
462
464
},
463
465
ClaimHTLC {
464
466
payment_preimage: PaymentPreimage,
@@ -7231,6 +7233,7 @@ where
7231
7233
ref onion_routing_packet,
7232
7234
skimmed_fee_msat,
7233
7235
blinding_point,
7236
+ hold_htlc,
7234
7237
..
7235
7238
} => {
7236
7239
match self.send_htlc(
@@ -7242,6 +7245,7 @@ where
7242
7245
false,
7243
7246
skimmed_fee_msat,
7244
7247
blinding_point,
7248
+ hold_htlc,
7245
7249
fee_estimator,
7246
7250
logger,
7247
7251
) {
@@ -8362,6 +8366,7 @@ where
8362
8366
onion_routing_packet: (**onion_packet).clone(),
8363
8367
skimmed_fee_msat: htlc.skimmed_fee_msat,
8364
8368
blinding_point: htlc.blinding_point,
8369
+ hold_htlc: htlc.hold_htlc.then(|| ()),
8365
8370
});
8366
8371
}
8367
8372
}
@@ -10586,7 +10591,8 @@ where
10586
10591
pub fn queue_add_htlc<F: Deref, L: Deref>(
10587
10592
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
10588
10593
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,
10590
10596
) -> Result<(), (LocalHTLCFailureReason, String)>
10591
10597
where
10592
10598
F::Target: FeeEstimator,
@@ -10601,6 +10607,7 @@ where
10601
10607
true,
10602
10608
skimmed_fee_msat,
10603
10609
blinding_point,
10610
+ hold_htlc,
10604
10611
fee_estimator,
10605
10612
logger,
10606
10613
)
@@ -10631,7 +10638,7 @@ where
10631
10638
fn send_htlc<F: Deref, L: Deref>(
10632
10639
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
10633
10640
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,
10635
10642
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
10636
10643
) -> Result<bool, (LocalHTLCFailureReason, String)>
10637
10644
where
@@ -10713,6 +10720,7 @@ where
10713
10720
onion_routing_packet,
10714
10721
skimmed_fee_msat,
10715
10722
blinding_point,
10723
+ hold_htlc,
10716
10724
});
10717
10725
return Ok(false);
10718
10726
}
@@ -10734,6 +10742,7 @@ where
10734
10742
blinding_point,
10735
10743
skimmed_fee_msat,
10736
10744
send_timestamp,
10745
+ hold_htlc,
10737
10746
});
10738
10747
self.context.next_holder_htlc_id += 1;
10739
10748
@@ -10977,7 +10986,7 @@ where
10977
10986
pub fn send_htlc_and_commit<F: Deref, L: Deref>(
10978
10987
&mut self, amount_msat: u64, payment_hash: PaymentHash, cltv_expiry: u32,
10979
10988
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,
10981
10990
) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
10982
10991
where
10983
10992
F::Target: FeeEstimator,
@@ -10992,6 +11001,7 @@ where
10992
11001
false,
10993
11002
skimmed_fee_msat,
10994
11003
None,
11004
+ hold_htlc,
10995
11005
fee_estimator,
10996
11006
logger,
10997
11007
);
@@ -12629,6 +12639,7 @@ where
12629
12639
ref onion_routing_packet,
12630
12640
blinding_point,
12631
12641
skimmed_fee_msat,
12642
+ ..
12632
12643
} => {
12633
12644
0u8.write(writer)?;
12634
12645
amount_msat.write(writer)?;
@@ -13032,6 +13043,7 @@ where
13032
13043
skimmed_fee_msat: None,
13033
13044
blinding_point: None,
13034
13045
send_timestamp: None,
13046
+ hold_htlc: false, // TODO: Persistence
13035
13047
});
13036
13048
}
13037
13049
@@ -13050,6 +13062,7 @@ where
13050
13062
onion_routing_packet: Readable::read(reader)?,
13051
13063
skimmed_fee_msat: None,
13052
13064
blinding_point: None,
13065
+ hold_htlc: false, // TODO: Persistence
13053
13066
},
13054
13067
1 => HTLCUpdateAwaitingACK::ClaimHTLC {
13055
13068
payment_preimage: Readable::read(reader)?,
@@ -13944,6 +13957,7 @@ mod tests {
13944
13957
skimmed_fee_msat: None,
13945
13958
blinding_point: None,
13946
13959
send_timestamp: None,
13960
+ hold_htlc: false,
13947
13961
});
13948
13962
13949
13963
// Make sure when Node A calculates their local commitment transaction, none of the HTLCs pass
@@ -14398,6 +14412,7 @@ mod tests {
14398
14412
skimmed_fee_msat: None,
14399
14413
blinding_point: None,
14400
14414
send_timestamp: None,
14415
+ hold_htlc: false,
14401
14416
};
14402
14417
let mut pending_outbound_htlcs = vec![dummy_outbound_output.clone(); 10];
14403
14418
for (idx, htlc) in pending_outbound_htlcs.iter_mut().enumerate() {
@@ -14423,6 +14438,7 @@ mod tests {
14423
14438
},
14424
14439
skimmed_fee_msat: None,
14425
14440
blinding_point: None,
14441
+ hold_htlc: false,
14426
14442
};
14427
14443
let dummy_holding_cell_claim_htlc = |attribution_data| HTLCUpdateAwaitingACK::ClaimHTLC {
14428
14444
payment_preimage: PaymentPreimage([42; 32]),
0 commit comments