Struct lightning::routing::scoring::ProbabilisticScorerUsingTime
source · pub struct ProbabilisticScorerUsingTime<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time>where
L::Target: Logger,{ /* private fields */ }
Expand description
Probabilistic Score
implementation.
This is not exported to bindings users generally all users should use the ProbabilisticScorer
type alias.
Implementations§
source§impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerUsingTime<G, L, T>where
L::Target: Logger,
impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ProbabilisticScorerUsingTime<G, L, T>where L::Target: Logger,
sourcepub fn new(
params: ProbabilisticScoringParameters,
network_graph: G,
logger: L
) -> Self
pub fn new( params: ProbabilisticScoringParameters, network_graph: G, logger: L ) -> Self
Creates a new scorer using the given scoring parameters for sending payments from a node through a network graph.
sourcepub fn debug_log_liquidity_stats(&self)
pub fn debug_log_liquidity_stats(&self)
Dump the contents of this scorer into the configured logger.
Note that this writes roughly one line per channel for which we have a liquidity estimate, which may be a substantial amount of log output.
sourcepub fn estimated_channel_liquidity_range(
&self,
scid: u64,
target: &NodeId
) -> Option<(u64, u64)>
pub fn estimated_channel_liquidity_range( &self, scid: u64, target: &NodeId ) -> Option<(u64, u64)>
Query the estimated minimum and maximum liquidity available for sending a payment over the
channel with scid
towards the given target
node.
sourcepub fn historical_estimated_channel_liquidity_probabilities(
&self,
scid: u64,
target: &NodeId
) -> Option<([u16; 8], [u16; 8])>
pub fn historical_estimated_channel_liquidity_probabilities( &self, scid: u64, target: &NodeId ) -> Option<([u16; 8], [u16; 8])>
Query the historical estimated minimum and maximum liquidity available for sending a
payment over the channel with scid
towards the given target
node.
Returns two sets of 8 buckets. The first set describes the octiles for lower-bound liquidity estimates, the second set describes the octiles for upper-bound liquidity estimates. Each bucket describes the relative frequency at which we’ve seen a liquidity bound in the octile relative to the channel’s total capacity, on an arbitrary scale. Because the values are slowly decayed, more recent data points are weighted more heavily than older datapoints.
When scoring, the estimated probability that an upper-/lower-bound lies in a given octile relative to the channel’s total capacity is calculated by dividing that bucket’s value with the total of all buckets for the given bound.
For example, a value of [0, 0, 0, 0, 0, 0, 32]
indicates that we believe the probability
of a bound being in the top octile to be 100%, and have never (recently) seen it in any
other octiles. A value of [31, 0, 0, 0, 0, 0, 0, 32]
indicates we’ve seen the bound being
both in the top and bottom octile, and roughly with similar (recent) frequency.
Because the datapoints are decayed slowly over time, values will eventually return to
Some(([0; 8], [0; 8]))
.
sourcepub fn add_banned(&mut self, node_id: &NodeId)
pub fn add_banned(&mut self, node_id: &NodeId)
Marks the node with the given node_id
as banned, i.e.,
it will be avoided during path finding.
sourcepub fn remove_banned(&mut self, node_id: &NodeId)
pub fn remove_banned(&mut self, node_id: &NodeId)
Removes the node with the given node_id
from the list of nodes to avoid.
sourcepub fn set_manual_penalty(&mut self, node_id: &NodeId, penalty: u64)
pub fn set_manual_penalty(&mut self, node_id: &NodeId, penalty: u64)
Sets a manual penalty for the given node.
sourcepub fn remove_manual_penalty(&mut self, node_id: &NodeId)
pub fn remove_manual_penalty(&mut self, node_id: &NodeId)
Removes the node with the given node_id
from the list of manual penalties.
sourcepub fn clear_manual_penalties(&mut self)
pub fn clear_manual_penalties(&mut self)
Clears the list of manual penalties that are applied during path finding.
Trait Implementations§
source§impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ReadableArgs<(ProbabilisticScoringParameters, G, L)> for ProbabilisticScorerUsingTime<G, L, T>where
L::Target: Logger,
impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ReadableArgs<(ProbabilisticScoringParameters, G, L)> for ProbabilisticScorerUsingTime<G, L, T>where L::Target: Logger,
source§fn read<R: Read>(
r: &mut R,
args: (ProbabilisticScoringParameters, G, L)
) -> Result<Self, DecodeError>
fn read<R: Read>( r: &mut R, args: (ProbabilisticScoringParameters, G, L) ) -> Result<Self, DecodeError>
Self
in from the given Read
.source§impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> Score for ProbabilisticScorerUsingTime<G, L, T>where
L::Target: Logger,
impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> Score for ProbabilisticScorerUsingTime<G, L, T>where L::Target: Logger,
source§fn channel_penalty_msat(
&self,
short_channel_id: u64,
source: &NodeId,
target: &NodeId,
usage: ChannelUsage
) -> u64
fn channel_penalty_msat( &self, short_channel_id: u64, source: &NodeId, target: &NodeId, usage: ChannelUsage ) -> u64
send_amt_msat
through the
given channel in the direction from source
to target
. Read more