Struct 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.

(C-not exported) 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 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: &[&RouteHop], short_channel_id: u64)

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

fn payment_path_successful(&mut self, path: &[&RouteHop])

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

fn probe_failed(&mut self, path: &[&RouteHop], short_channel_id: u64)

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

fn probe_successful(&mut self, path: &[&RouteHop])

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
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> Freeze for ProbabilisticScorerUsingTime<G, L, T>
where G: Freeze, L: Freeze,

§

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

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.