Struct CombinedScorer

Source
pub struct CombinedScorer<G: Deref<Target = NetworkGraph<L>>, L: Deref>
where L::Target: Logger,
{ /* private fields */ }
Expand description

A probabilistic scorer that combines local and external information to score channels. This scorer is shadow-tracking local only scores, so that it becomes possible to cleanly merge external scores when they become available.

This is useful for nodes that have a limited local view of the network and need to augment their view with scores from an external source to improve payment reliability. The external source may use something like background probing to gather a more complete view of the network. Merging reduces the likelihood of losing unique local data on particular channels.

Note that only the locally acquired data is persisted. After a restart, the external scores will be lost and must be resupplied.

Implementations§

Source§

impl<G: Deref<Target = NetworkGraph<L>> + Clone, L: Deref + Clone> CombinedScorer<G, L>
where L::Target: Logger,

Source

pub fn new(local_scorer: ProbabilisticScorer<G, L>) -> Self

Create a new combined scorer with the given local scorer.

Source

pub fn merge( &mut self, external_scores: ChannelLiquidities, duration_since_epoch: Duration, )

Merge external channel liquidity information into the scorer.

Source

pub fn set_scores(&mut self, external_scores: ChannelLiquidities)

Overwrite the scorer state with the given external scores.

Trait Implementations§

Source§

impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreLookUp for CombinedScorer<G, L>
where L::Target: Logger,

Source§

type ScoreParams = ProbabilisticScoringFeeParameters

A configurable type which should contain various passed-in parameters for configuring the scorer, on a per-routefinding-call basis through to the scorer methods, which are used to determine the parameters for the suitability of channels for use.
Source§

fn channel_penalty_msat( &self, candidate: &CandidateRouteHop<'_>, usage: ChannelUsage, score_params: &ProbabilisticScoringFeeParameters, ) -> 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§

impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> ScoreUpdate for CombinedScorer<G, L>
where L::Target: Logger,

Source§

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

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

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

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

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

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

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

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

fn time_passed(&mut self, duration_since_epoch: Duration)

Scorers may wish to reduce their certainty of channel liquidity information over time. Thus, this method is provided to allow scorers to observe the passage of time - the holder of this object should call this method regularly (generally via the lightning-background-processor crate).
Source§

impl<G: Deref<Target = NetworkGraph<L>>, L: Deref> Writeable for CombinedScorer<G, L>
where L::Target: Logger,

Source§

fn write<W: Writer>(&self, writer: &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> Freeze for CombinedScorer<G, L>
where G: Freeze, L: Freeze,

§

impl<G, L> RefUnwindSafe for CombinedScorer<G, L>

§

impl<G, L> Send for CombinedScorer<G, L>
where G: Send, L: Send,

§

impl<G, L> Sync for CombinedScorer<G, L>
where G: Sync, L: Sync,

§

impl<G, L> Unpin for CombinedScorer<G, L>
where G: Unpin, L: Unpin,

§

impl<G, L> UnwindSafe for CombinedScorer<G, L>
where G: UnwindSafe, L: 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Score for T