]> git.bitcoin.ninja Git - rust-lightning/commit
Effective channel capacity for router and scoring
authorJeffrey Czyz <jkczyz@gmail.com>
Wed, 29 Dec 2021 15:56:54 +0000 (09:56 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Thu, 27 Jan 2022 01:49:12 +0000 (19:49 -0600)
commita41f6a31f5fb82320d1f32e6276146f2784e8be5
treef8d29a19a6d842054b8ea1741e3a94976defe51d
parent457e48e1025aced95ccca65d9ca78ec6b0a4ed61
Effective channel capacity for router and scoring

A channel's capacity may be inferred or learned and is used to make
routing decisions, including as a parameter to channel scoring. Define
an EffectiveCapacity for this purpose. Score::channel_penalty_msat takes
the effective capacity (less in-flight HTLCs for the same payment), and
never None. Thus, for hops given in an invoice, the effective capacity
is now considered (near) infinite if over a private channel or based on
learned information if over a public channel.

If a Score implementations needs the effective capacity when updating a
channel's score, i.e. in payment_path_failed or payment_path_successful,
it can access the channel's EffectiveCapacity via the NetworkGraph by
first looking up the channel and then specifying which direction is
desired using ChannelInfo::as_directed.
lightning-invoice/src/payment.rs
lightning/src/routing/network_graph.rs
lightning/src/routing/router.rs
lightning/src/routing/scoring.rs