UNPKG

lightningdevkit

Version:
40 lines (39 loc) 2.32 kB
import { CandidateRouteHop } from '../structs/CandidateRouteHop.mjs'; import { ChannelUsage } from '../structs/ChannelUsage.mjs'; import { ProbabilisticScoringFeeParameters } from '../structs/ProbabilisticScoringFeeParameters.mjs'; import { CommonBase } from './CommonBase.mjs'; /** An implementation of ScoreLookUp */ export interface ScoreLookUpInterface { /**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. */ channel_penalty_msat(candidate: CandidateRouteHop, usage: ChannelUsage, score_params: ProbabilisticScoringFeeParameters): bigint; } /** * An interface used to score payment channels for path finding. * * `ScoreLookUp` is used to determine the penalty for a given channel. * * Scoring is in terms of fees willing to be paid in order to avoid routing through a channel. */ export declare class ScoreLookUp extends CommonBase { /** Creates a new instance of ScoreLookUp from a given implementation */ static new_impl(arg: ScoreLookUpInterface): ScoreLookUp; /** * 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. */ channel_penalty_msat(candidate: CandidateRouteHop, usage: ChannelUsage, score_params: ProbabilisticScoringFeeParameters): bigint; }