Package org.ldk.structs
Class ProbabilisticScorer
- java.lang.Object
-
- org.ldk.structs.ProbabilisticScorer
-
public class ProbabilisticScorer extends Object
[`Score`] implementation using channel success probability distributions. Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability distributions are defined based on knowledge learned from successful and unsuccessful attempts. Then the negative `log10` of the success probability is used to determine the cost of routing a specific HTLC amount through a channel. Knowledge about channel liquidity balances takes the form of upper and lower bounds on the possible liquidity. Certainty of the bounds is decreased over time using a decay function. See [`ProbabilisticScoringParameters`] for details. Since the scorer aims to learn the current channel liquidity balances, it works best for nodes with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment volume are more likely to experience failed payment paths, which would need to be retried. # Note Mixing the `no-std` feature between serialization and deserialization results in undefined behavior. [1]: https://arxiv.org/abs/2107.05322
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Scoreas_Score()Constructs a new Score which calls the relevant methods on this_arg.voiddebug_log_liquidity_stats()Dump the contents of this scorer into the configured logger.protected voidfinalize()static ProbabilisticScorerof(ProbabilisticScoringParameters params, NetworkGraph network_graph, Logger logger)Creates a new scorer using the given scoring parameters for sending payments from a node through a network graph.static Result_ProbabilisticScorerDecodeErrorZread(byte[] ser, ProbabilisticScoringParameters arg_a, NetworkGraph arg_b, Logger arg_c)Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_writebyte[]write()Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
of
public static ProbabilisticScorer of(ProbabilisticScoringParameters params, NetworkGraph network_graph, Logger logger)
Creates a new scorer using the given scoring parameters for sending payments from a node through a network graph.
-
debug_log_liquidity_stats
public void debug_log_liquidity_stats()
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.
-
as_Score
public Score as_Score()
Constructs a new Score which calls the relevant methods on this_arg. This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
-
write
public byte[] write()
Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
-
read
public static Result_ProbabilisticScorerDecodeErrorZ read(byte[] ser, ProbabilisticScoringParameters arg_a, NetworkGraph arg_b, Logger arg_c)
Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
-
-