You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
log_trace!(logger,"Building path from {} (payee) to {} (us/payer) for value {} msat.", payment_params.payee_pubkey, our_node_pubkey, final_value_msat);
815
838
816
839
macro_rules! add_entry {
@@ -4894,6 +4917,32 @@ mod tests {
4894
4917
assert_eq!(route.paths[1][0].short_channel_id,2);
4895
4918
assert_eq!(route.paths[1][0].fee_msat,50_000);
4896
4919
}
4920
+
4921
+
{
4922
+
// If we have a bunch of outbound channels to the same node, where most are not
4923
+
// sufficient to pay the full payment, but one is, we should default to just using the
4924
+
// one single channel that has sufficient balance, avoiding MPP.
4925
+
//
4926
+
// If we have several options above the 3xpayment value threshold, we should pick the
4927
+
// smallest of them, avoiding further fragmenting our available outbound balance to
4928
+
// this node.
4929
+
let route = get_route(&our_id,&payment_params,&network_graph.read_only(),Some(&[
0 commit comments