Class Score


  • public class Score
    extends Object
    An interface used to score payment channels for path finding. \tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
    • Method Detail

      • channel_penalty_msat

        public long channel_penalty_msat​(long short_channel_id,
                                         NodeId source,
                                         NodeId target,
                                         ChannelUsage usage)
        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`. The channel's capacity (less any other MPP parts that are also being considered for use in the same payment) is given by `capacity_msat`. It may be determined from various sources such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. Thus, implementations should be overflow-safe.
      • payment_path_failed

        public void payment_path_failed​(RouteHop[] path,
                                        long short_channel_id)
        Handles updating channel penalties after failing to route through a channel.
      • payment_path_successful

        public void payment_path_successful​(RouteHop[] path)
        Handles updating channel penalties after successfully routing along a path.
      • probe_failed

        public void probe_failed​(RouteHop[] path,
                                 long short_channel_id)
        Handles updating channel penalties after a probe over the given path failed.
      • probe_successful

        public void probe_successful​(RouteHop[] path)
        Handles updating channel penalties after a probe over the given path succeeded.
      • write

        public byte[] write()
        Serialize the object into a byte array