@@ -397,6 +397,36 @@ pub struct ChannelConfig {
397
397
/// [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
398
398
/// [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
399
399
pub force_close_avoidance_max_fee_satoshis : u64 ,
400
+ /// If set, allows this channel's counterparty to skim an additional fee off of this node's
401
+ /// inbound HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
402
+ ///
403
+ /// Usage:
404
+ /// - The payee will set this option and set its invoice route hints to use [`intercept scids`]
405
+ /// generated by this channel's counterparty.
406
+ /// - If this fee is being taken by a liquidity provider for a just-in-time channel, payees MUST
407
+ /// disable MPP in their invoices unless they have a way to let their counterparty know when all
408
+ /// MPP parts have been aggregated. Otherwise, excess channels may be opened for each MPP part.
409
+ /// - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
410
+ /// [`forward_intercepted_htlc`] with less than the amount provided in
411
+ /// [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
412
+ /// actual forward amounts is their fee.
413
+ ///
414
+ /// # Note
415
+ /// It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
416
+ /// as-expected if this feature is activated, otherwise they may lose money!
417
+ ///
418
+ /// # Note
419
+ /// Switching on this config flag may break compatibility with versions of LDK prior to 0.0.116.
420
+ ///
421
+ /// Default value: false.
422
+ ///
423
+ /// [`intercept scids`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
424
+ /// [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
425
+ /// [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
426
+ /// [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat
427
+ /// [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat
428
+ // TODO: link to bLIP when it's merged
429
+ pub accept_underpaying_htlcs : bool ,
400
430
}
401
431
402
432
impl Default for ChannelConfig {
@@ -408,12 +438,14 @@ impl Default for ChannelConfig {
408
438
cltv_expiry_delta : 6 * 12 , // 6 blocks/hour * 12 hours
409
439
max_dust_htlc_exposure_msat : 5_000_000 ,
410
440
force_close_avoidance_max_fee_satoshis : 1000 ,
441
+ accept_underpaying_htlcs : false ,
411
442
}
412
443
}
413
444
}
414
445
415
446
impl_writeable_tlv_based ! ( ChannelConfig , {
416
447
( 0 , forwarding_fee_proportional_millionths, required) ,
448
+ ( 1 , accept_underpaying_htlcs, ( default_value, false ) ) ,
417
449
( 2 , forwarding_fee_base_msat, required) ,
418
450
( 4 , cltv_expiry_delta, required) ,
419
451
( 6 , max_dust_htlc_exposure_msat, required) ,
@@ -488,6 +520,7 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
488
520
cltv_expiry_delta,
489
521
force_close_avoidance_max_fee_satoshis,
490
522
forwarding_fee_base_msat,
523
+ accept_underpaying_htlcs : false ,
491
524
} ,
492
525
announced_channel,
493
526
commit_upfront_shutdown_pubkey,
0 commit comments