]> 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, 20 Jan 2022 22:14:31 +0000 (16:14 -0600)
commitc4e5bd3144264274c4786655d3278190944ae623
treeef508495ea72c7d51358b882d6b21429b6016bea
parentba8d084b357f0b18d68af3cda13e0585ad966ecd
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