Avoid needless MPP on multiple channels to the same first-hop 2022-03-pref-first-hop-chans
authorMatt Corallo <git@bluematt.me>
Fri, 18 Mar 2022 23:19:51 +0000 (23:19 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 23 Mar 2022 21:01:49 +0000 (21:01 +0000)
commitb1bc07802ea5cf05888c47f1373e123a75a6f519
tree6e7412f42afb0bea04d5532b60d3e85ae2e1de99
parent5ed2985caec6d3ba80eeac02e9a3d79c4d73a5de
Avoid needless MPP on multiple channels to the same first-hop

When we have many channels to the same first-hop, many of which do
not have sufficient balance to make the requested payment, but when
some do, instead of simply using the available channel balance we
may switch to MPP, potentially with many, many paths.

Instead, we should seek to use the smallest channel which can
easily handle the requested payment, which we do here by sorting
the first_hops in our router before beginning the graph search.

Note that the "real" fix for this should be to instead decide which
channel to use at HTLC-send time, as most other nodes do during
relay, but this provides a minimal fix without needing to do the
rather-large work of refactoring our HTLC send+relay pipelines.

Issues with overly-aggressive MPP on many channels were reported by
Cash App.
lightning/src/routing/router.rs