Limit the number of pending un-funded inbound channel 2023-01-limited-chans
authorMatt Corallo <git@bluematt.me>
Thu, 26 Jan 2023 04:47:25 +0000 (04:47 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 21 Feb 2023 22:01:47 +0000 (22:01 +0000)
commitd5fb804a329e36ac41e1b85e3fedce8d5dc40e6b
tree712b0d3a9884257ea70b0c646cfc416ab6ec7a5b
parent4155f54716f6bc8632d2a501d22c51a2545670b1
Limit the number of pending un-funded inbound channel

Because we store some (not large, but not zero) state per-peer,
it's useful to limit the number of peers we have connected, at
least with some buffer.

Much more importantly, each channel has a relatively large cost,
especially around the `ChannelMonitor`s we have to build for each.

Thus, here, we limit the number of channels per-peer which aren't
(yet) on-chain, as well as limit the number of (inbound) peers
which don't have a (funded-on-chain) channel.

Fixes #1889
lightning/src/ln/channelmanager.rs