]> 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>
Mon, 3 Jan 2022 17:36:29 +0000 (11:36 -0600)
commit0a9c2af336b6d4c98b0bfb1c8febe74f0d23abd3
treec387b2ab41cc6e6a0d8b58e47621c0e1039cf039
parent036ea119541553bdd17db84a48eb18e0232b2333
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/src/routing/network_graph.rs
lightning/src/routing/router.rs
lightning/src/routing/scoring.rs