Add channel scoring to get_route
authorJeffrey Czyz <jkczyz@gmail.com>
Mon, 27 Sep 2021 20:52:57 +0000 (13:52 -0700)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 15 Oct 2021 20:29:49 +0000 (15:29 -0500)
commite15a18a503a64625693ce20cabee00b20c9f3874
treedd0a301acab8a5eb2699055c41c4bdc1049ea578
parentda498d7974bb1e8de5ccec090a1819e63f882350
Add channel scoring to get_route

Failed payments may be retried, but calling get_route may return a Route
with the same failing path. Add a routing::Score trait used to
parameterize get_route, which it calls to determine how much a channel
should be penalized in terms of msats willing to pay to avoid the
channel.

Also, add a Scorer struct that implements routing::Score with a constant
constant penalty. Subsequent changes will allow for more robust scoring
by feeding back payment path success and failure to the scorer via event
handling.
fuzz/src/full_stack.rs
fuzz/src/router.rs
lightning-invoice/src/utils.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/shutdown_tests.rs
lightning/src/routing/mod.rs
lightning/src/routing/router.rs
lightning/src/routing/scorer.rs [new file with mode: 0644]