Avoid saturating channels before we split payments
authorMatt Corallo <git@bluematt.me>
Fri, 8 Jul 2022 18:26:06 +0000 (18:26 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 13 Jul 2022 18:36:50 +0000 (18:36 +0000)
commitbd6b710328ec6d116d43162ac6922e5b007e3e3c
tree634a84acc2ccf0025ace8df2284a1e523e76bf5c
parent4e5f74a6f30baee087b805564a2445d2840f120c
Avoid saturating channels before we split payments

Currently we only opt to split a payment into an MPP if we have
completely and totally used a channel's available capacity (up to
the announced htlc_max or on-chain capacity, whichever is lower).
This is obviously destined to fail as channels are unlikely to have
their full capacity available.

Here we do the minimum viable fix by simply limiting channels to
only using up to a configurable power-of-1/2. We default this new
configuration knob to 1 (1/2 of the channel) so as to avoid a
substantial change but in the future we may consider changing this
to 2 (1/4) or even 3 (1/8).
lightning/src/routing/gossip.rs
lightning/src/routing/router.rs