@@ -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 ChannelConfig {
@@ -429,12 +459,14 @@ impl Default for ChannelConfig {
429
459
cltv_expiry_delta : 6 * 12 , // 6 blocks/hour * 12 hours
430
460
max_dust_htlc_exposure_msat : 5_000_000 ,
431
461
force_close_avoidance_max_fee_satoshis : 1000 ,
462
+ accept_underpaying_htlcs : false ,
432
463
}
433
464
}
434
465
}
435
466
436
467
impl_writeable_tlv_based ! ( ChannelConfig , {
437
468
( 0 , forwarding_fee_proportional_millionths, required) ,
469
+ ( 1 , accept_underpaying_htlcs, ( default_value, false ) ) ,
438
470
( 2 , forwarding_fee_base_msat, required) ,
439
471
( 4 , cltv_expiry_delta, required) ,
440
472
( 6 , max_dust_htlc_exposure_msat, required) ,
@@ -543,6 +575,7 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
543
575
cltv_expiry_delta,
544
576
force_close_avoidance_max_fee_satoshis,
545
577
forwarding_fee_base_msat,
578
+ accept_underpaying_htlcs : false ,
546
579
} ,
547
580
announced_channel,
548
581
commit_upfront_shutdown_pubkey,
0 commit comments