66// accordance with one or both of these licenses.
77
88use crate :: chain:: ChainSource ;
9+ use crate :: config:: ChannelConfig ;
910use crate :: fee_estimator:: OnchainFeeEstimator ;
1011use crate :: logger:: FilesystemLogger ;
1112use crate :: message_handler:: NodeCustomMessageHandler ;
@@ -20,8 +21,6 @@ use lightning::routing::gossip;
2021use lightning:: routing:: router:: DefaultRouter ;
2122use lightning:: routing:: scoring:: { ProbabilisticScorer , ProbabilisticScoringFeeParameters } ;
2223use lightning:: sign:: InMemorySigner ;
23- use lightning:: util:: config:: ChannelConfig as LdkChannelConfig ;
24- use lightning:: util:: config:: MaxDustHTLCExposure as LdkMaxDustHTLCExposure ;
2524use lightning:: util:: persist:: KVStore ;
2625use lightning:: util:: ser:: { Readable , Writeable , Writer } ;
2726use lightning:: util:: sweep:: OutputSweeper ;
@@ -349,119 +348,3 @@ pub struct PeerDetails {
349348 /// Indicates whether we currently have an active connection with the peer.
350349 pub is_connected : bool ,
351350}
352-
353- /// Options which apply on a per-channel basis and may change at runtime or based on negotiation
354- /// with our counterparty.
355- #[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
356- pub struct ChannelConfig {
357- /// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
358- /// over the channel.
359- /// This may be allowed to change at runtime in a later update, however doing so must result in
360- /// update messages sent to notify all nodes of our updated relay fee.
361- ///
362- /// Please refer to [`LdkChannelConfig`] for further details.
363- pub forwarding_fee_proportional_millionths : u32 ,
364- /// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
365- /// excess of [`ChannelConfig::forwarding_fee_proportional_millionths`].
366- /// This may be allowed to change at runtime in a later update, however doing so must result in
367- /// update messages sent to notify all nodes of our updated relay fee.
368- ///
369- /// Please refer to [`LdkChannelConfig`] for further details.
370- pub forwarding_fee_base_msat : u32 ,
371- /// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
372- /// the channel this config applies to.
373- ///
374- /// Please refer to [`LdkChannelConfig`] for further details.
375- pub cltv_expiry_delta : u16 ,
376- /// Limit our total exposure to potential loss to on-chain fees on close, including in-flight
377- /// HTLCs which are burned to fees as they are too small to claim on-chain and fees on
378- /// commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate.
379- ///
380- /// Please refer to [`LdkChannelConfig`] for further details.
381- pub max_dust_htlc_exposure : MaxDustHTLCExposure ,
382- /// The additional fee we're willing to pay to avoid waiting for the counterparty's
383- /// `to_self_delay` to reclaim funds.
384- ///
385- /// Please refer to [`LdkChannelConfig`] for further details.
386- pub force_close_avoidance_max_fee_satoshis : u64 ,
387- /// If set, allows this channel's counterparty to skim an additional fee off this node's inbound
388- /// HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.
389- ///
390- /// Please refer to [`LdkChannelConfig`] for further details.
391- pub accept_underpaying_htlcs : bool ,
392- }
393-
394- impl From < LdkChannelConfig > for ChannelConfig {
395- fn from ( value : LdkChannelConfig ) -> Self {
396- Self {
397- forwarding_fee_proportional_millionths : value. forwarding_fee_proportional_millionths ,
398- forwarding_fee_base_msat : value. forwarding_fee_base_msat ,
399- cltv_expiry_delta : value. cltv_expiry_delta ,
400- max_dust_htlc_exposure : value. max_dust_htlc_exposure . into ( ) ,
401- force_close_avoidance_max_fee_satoshis : value. force_close_avoidance_max_fee_satoshis ,
402- accept_underpaying_htlcs : value. accept_underpaying_htlcs ,
403- }
404- }
405- }
406-
407- impl From < ChannelConfig > for LdkChannelConfig {
408- fn from ( value : ChannelConfig ) -> Self {
409- Self {
410- forwarding_fee_proportional_millionths : value. forwarding_fee_proportional_millionths ,
411- forwarding_fee_base_msat : value. forwarding_fee_base_msat ,
412- cltv_expiry_delta : value. cltv_expiry_delta ,
413- max_dust_htlc_exposure : value. max_dust_htlc_exposure . into ( ) ,
414- force_close_avoidance_max_fee_satoshis : value. force_close_avoidance_max_fee_satoshis ,
415- accept_underpaying_htlcs : value. accept_underpaying_htlcs ,
416- }
417- }
418- }
419-
420- impl Default for ChannelConfig {
421- fn default ( ) -> Self {
422- LdkChannelConfig :: default ( ) . into ( )
423- }
424- }
425-
426- /// Options for how to set the max dust exposure allowed on a channel.
427- ///
428- /// See [`LdkChannelConfig::max_dust_htlc_exposure`] for details.
429- #[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
430- pub enum MaxDustHTLCExposure {
431- /// This sets a fixed limit on the total dust exposure in millisatoshis.
432- ///
433- /// Please refer to [`LdkMaxDustHTLCExposure`] for further details.
434- FixedLimit {
435- /// The fixed limit, in millisatoshis.
436- limit_msat : u64 ,
437- } ,
438- /// This sets a multiplier on the feerate to determine the maximum allowed dust exposure.
439- ///
440- /// Please refer to [`LdkMaxDustHTLCExposure`] for further details.
441- FeeRateMultiplier {
442- /// The applied fee rate multiplier.
443- multiplier : u64 ,
444- } ,
445- }
446-
447- impl From < LdkMaxDustHTLCExposure > for MaxDustHTLCExposure {
448- fn from ( value : LdkMaxDustHTLCExposure ) -> Self {
449- match value {
450- LdkMaxDustHTLCExposure :: FixedLimitMsat ( limit_msat) => Self :: FixedLimit { limit_msat } ,
451- LdkMaxDustHTLCExposure :: FeeRateMultiplier ( multiplier) => {
452- Self :: FeeRateMultiplier { multiplier }
453- } ,
454- }
455- }
456- }
457-
458- impl From < MaxDustHTLCExposure > for LdkMaxDustHTLCExposure {
459- fn from ( value : MaxDustHTLCExposure ) -> Self {
460- match value {
461- MaxDustHTLCExposure :: FixedLimit { limit_msat } => Self :: FixedLimitMsat ( limit_msat) ,
462- MaxDustHTLCExposure :: FeeRateMultiplier { multiplier } => {
463- Self :: FeeRateMultiplier ( multiplier)
464- } ,
465- }
466- }
467- }
0 commit comments