Class ProbabilisticScoringParameters


  • public class ProbabilisticScoringParameters
    extends Object
    Parameters for configuring [`ProbabilisticScorer`]. Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
    • Method Detail

      • get_base_penalty_msat

        public long get_base_penalty_msat()
        A fixed penalty in msats to apply to each channel. Default value: 500 msat
      • set_base_penalty_msat

        public void set_base_penalty_msat​(long val)
        A fixed penalty in msats to apply to each channel. Default value: 500 msat
      • get_liquidity_penalty_multiplier_msat

        public long get_liquidity_penalty_multiplier_msat()
        A multiplier used in conjunction with the negative `log10` of the channel's success probability for a payment to determine the liquidity penalty. The penalty is based in part on the knowledge learned from prior successful and unsuccessful payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to lower bounding the success probability to `0.01`) when the amount falls within the uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will result in a `u64::max_value` penalty, however. Default value: 40,000 msat [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
      • set_liquidity_penalty_multiplier_msat

        public void set_liquidity_penalty_multiplier_msat​(long val)
        A multiplier used in conjunction with the negative `log10` of the channel's success probability for a payment to determine the liquidity penalty. The penalty is based in part on the knowledge learned from prior successful and unsuccessful payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to lower bounding the success probability to `0.01`) when the amount falls within the uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will result in a `u64::max_value` penalty, however. Default value: 40,000 msat [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
      • get_liquidity_offset_half_life

        public long get_liquidity_offset_half_life()
        The time required to elapse before any knowledge learned about channel liquidity balances is cut in half. The bounds are defined in terms of offsets and are initially zero. Increasing the offsets gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases the certainty of the channel liquidity balance. Default value: 1 hour # Note When built with the `no-std` feature, time will never elapse. Therefore, the channel liquidity knowledge will never decay except when the bounds cross.
      • set_liquidity_offset_half_life

        public void set_liquidity_offset_half_life​(long val)
        The time required to elapse before any knowledge learned about channel liquidity balances is cut in half. The bounds are defined in terms of offsets and are initially zero. Increasing the offsets gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases the certainty of the channel liquidity balance. Default value: 1 hour # Note When built with the `no-std` feature, time will never elapse. Therefore, the channel liquidity knowledge will never decay except when the bounds cross.
      • get_amount_penalty_multiplier_msat

        public long get_amount_penalty_multiplier_msat()
        A multiplier used in conjunction with a payment amount and the negative `log10` of the channel's success probability for the payment to determine the amount penalty. The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., fees plus penalty) for large payments. The penalty is computed as the product of this multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the success probability. `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20` In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of the amount will result in a penalty of the multiplier. And, as the success probability decreases, the negative `log10` weighting will increase dramatically. For higher success probabilities, the multiplier will have a decreasing effect as the negative `log10` will fall below `1`. Default value: 256 msat
      • set_amount_penalty_multiplier_msat

        public void set_amount_penalty_multiplier_msat​(long val)
        A multiplier used in conjunction with a payment amount and the negative `log10` of the channel's success probability for the payment to determine the amount penalty. The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., fees plus penalty) for large payments. The penalty is computed as the product of this multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the success probability. `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20` In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of the amount will result in a penalty of the multiplier. And, as the success probability decreases, the negative `log10` weighting will increase dramatically. For higher success probabilities, the multiplier will have a decreasing effect as the negative `log10` will fall below `1`. Default value: 256 msat
      • of

        public static ProbabilisticScoringParameters of​(long base_penalty_msat_arg,
                                                        long liquidity_penalty_multiplier_msat_arg,
                                                        long liquidity_offset_half_life_arg,
                                                        long amount_penalty_multiplier_msat_arg)
        Constructs a new ProbabilisticScoringParameters given each field
      • with_default

        public static ProbabilisticScoringParameters with_default()
        Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.