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,

source

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.

source

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.

source

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.

source

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])).

source

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.

source

pub fn remove_banned(&mut self, node_id: &NodeId)

Removes the node with the given node_id from the list of nodes to avoid.

source

pub fn set_manual_penalty(&mut self, node_id: &NodeId, penalty: u64)

Sets a manual penalty for the given node.

source

pub fn remove_manual_penalty(&mut self, node_id: &NodeId)

Removes the node with the given node_id from the list of manual penalties.

source

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,

source§

fn read<R: Read>( r: &mut R, args: (ProbabilisticScoringParameters, G, L) ) -> Result<Self, DecodeError>

Reads a 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,

source§

fn channel_penalty_msat( &self, short_channel_id: u64, source: &NodeId, target: &NodeId, usage: ChannelUsage ) -> u64

Returns the fee in msats willing to be paid to avoid routing send_amt_msat through the given channel in the direction from source to target. Read more
source§

fn payment_path_failed(&mut self, path: &Path, short_channel_id: u64)

Handles updating channel penalties after failing to route through a channel.
source§

fn payment_path_successful(&mut self, path: &Path)

Handles updating channel penalties after successfully routing along a path.
source§

fn probe_failed(&mut self, path: &Path, short_channel_id: u64)

Handles updating channel penalties after a probe over the given path failed.
source§

fn probe_successful(&mut self, path: &Path)

Handles updating channel penalties after a probe over the given path succeeded.
source§

impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> Writeable for ProbabilisticScorerUsingTime<G, L, T>where L::Target: Logger,

source§

fn write<W: Writer>(&self, w: &mut W) -> Result<(), Error>

Writes self out to the given Writer.
source§

fn encode(&self) -> Vec<u8>

Writes self out to a Vec<u8>.
source§

fn serialized_length(&self) -> usize

Gets the length of this object after it has been serialized. This can be overridden to optimize cases where we prepend an object with its length.

Auto Trait Implementations§

§

impl<G, L, T> RefUnwindSafe for ProbabilisticScorerUsingTime<G, L, T>where G: RefUnwindSafe, L: RefUnwindSafe, T: RefUnwindSafe,

§

impl<G, L, T> Send for ProbabilisticScorerUsingTime<G, L, T>where G: Send, L: Send, T: Send,

§

impl<G, L, T> Sync for ProbabilisticScorerUsingTime<G, L, T>where G: Sync, L: Sync, T: Sync,

§

impl<G, L, T> Unpin for ProbabilisticScorerUsingTime<G, L, T>where G: Unpin, L: Unpin, T: Unpin,

§

impl<G, L, T> UnwindSafe for ProbabilisticScorerUsingTime<G, L, T>where G: UnwindSafe, L: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.