]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Rename EffectiveCapacity::MaximumHTLC to ::AdvertisedMaxHTLC
authorValentine Wallace <vwallace@protonmail.com>
Wed, 17 May 2023 20:08:54 +0000 (16:08 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 17 May 2023 22:43:56 +0000 (18:43 -0400)
Also get rid of some trailing whitespace because my text editor likes to do
that.

We'll next add a new variant for max_htlc provided in route hints, which will
be treated differently in scoring.

lightning/src/routing/gossip.rs
lightning/src/routing/router.rs
lightning/src/routing/scoring.rs

index c5c08cf40321185a864aee4e814d39cc62f91abd..9a9a932968cb5f791cdbaa49129cb0af15140864 100644 (file)
@@ -965,7 +965,7 @@ impl<'a> DirectedChannelInfo<'a> {
                                htlc_maximum_msat = cmp::min(htlc_maximum_msat, capacity_msat);
                                EffectiveCapacity::Total { capacity_msat, htlc_maximum_msat: htlc_maximum_msat }
                        },
-                       None => EffectiveCapacity::MaximumHTLC { amount_msat: htlc_maximum_msat },
+                       None => EffectiveCapacity::AdvertisedMaxHTLC { amount_msat: htlc_maximum_msat },
                };
 
                Self {
@@ -1019,7 +1019,7 @@ pub enum EffectiveCapacity {
                liquidity_msat: u64,
        },
        /// The maximum HTLC amount in one direction as advertised on the gossip network.
-       MaximumHTLC {
+       AdvertisedMaxHTLC {
                /// The maximum HTLC amount denominated in millisatoshi.
                amount_msat: u64,
        },
@@ -1047,7 +1047,7 @@ impl EffectiveCapacity {
        pub fn as_msat(&self) -> u64 {
                match self {
                        EffectiveCapacity::ExactLiquidity { liquidity_msat } => *liquidity_msat,
-                       EffectiveCapacity::MaximumHTLC { amount_msat } => *amount_msat,
+                       EffectiveCapacity::AdvertisedMaxHTLC { amount_msat } => *amount_msat,
                        EffectiveCapacity::Total { capacity_msat, .. } => *capacity_msat,
                        EffectiveCapacity::Infinite => u64::max_value(),
                        EffectiveCapacity::Unknown => UNKNOWN_CHANNEL_CAPACITY_MSAT,
@@ -1575,7 +1575,7 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
 
                if msg.chain_hash != self.genesis_hash {
                        return Err(LightningError {
-                               err: "Channel announcement chain hash does not match genesis hash".to_owned(), 
+                               err: "Channel announcement chain hash does not match genesis hash".to_owned(),
                                action: ErrorAction::IgnoreAndLog(Level::Debug),
                        });
                }
index b33e021ab4fc30357a1124885c45b076419aed61..140148ca354b2e6f5219d53b71795ae278adf927 100644 (file)
@@ -963,7 +963,7 @@ fn max_htlc_from_capacity(capacity: EffectiveCapacity, max_channel_saturation_po
                EffectiveCapacity::ExactLiquidity { liquidity_msat } => liquidity_msat,
                EffectiveCapacity::Infinite => u64::max_value(),
                EffectiveCapacity::Unknown => EffectiveCapacity::Unknown.as_msat(),
-               EffectiveCapacity::MaximumHTLC { amount_msat } =>
+               EffectiveCapacity::AdvertisedMaxHTLC { amount_msat } =>
                        amount_msat.checked_shr(saturation_shift).unwrap_or(0),
                EffectiveCapacity::Total { capacity_msat, htlc_maximum_msat } =>
                        cmp::min(capacity_msat.checked_shr(saturation_shift).unwrap_or(0), htlc_maximum_msat),
index 235b1a148a5824ad020cf88dc3fc652679e3ba1f..2ffb3251b9fb2e36ffc82408940ce57f3a7a3ca6 100644 (file)
@@ -2869,7 +2869,7 @@ mod tests {
                let usage = ChannelUsage {
                        amount_msat: 1,
                        inflight_htlc_msat: 0,
-                       effective_capacity: EffectiveCapacity::MaximumHTLC { amount_msat: 0 },
+                       effective_capacity: EffectiveCapacity::AdvertisedMaxHTLC { amount_msat: 0 },
                };
                assert_eq!(scorer.channel_penalty_msat(42, &target, &source, usage, &params), 2048);