paymod: Track how many HTLCs each channel can still add

It turns out that by aggressively splitting payments we may end up exhausting
the number of HTLCs we can add to a channel quickly. By tracking the number of
HTLCs we can still add, and excluding the channels to which we cannot add any
more we increase the route diversity, and avoid quickly exhausting the HTLC
budget.

In the next commit we'll also implement an early abort if we've exhausted all
channels, so we don't end up splitting indefinitely and we can also optimize
the initial split to not run afoul of that limit.
This commit is contained in:
Christian Decker
2020-07-20 20:28:31 +02:00
committed by Rusty Russell
parent ce48fecb6f
commit a1dc9cbd97
2 changed files with 41 additions and 2 deletions

View File

@@ -69,6 +69,14 @@ struct channel_hint {
/* Is the channel enabled? */
bool enabled;
/* True if we are one endpoint of this channel */
bool local;
/* How many more htlcs can we send over this channel? Only set if this
* is a local channel, because those are the channels we have exact
* numbers on, and they are the bottleneck onto the network. */
u16 htlc_budget;
};
/* Each payment goes through a number of steps that are always processed in