Allow `RoutingMessageHandler` to signal backpressure
authorMatt Corallo <git@bluematt.me>
Sun, 22 Jan 2023 05:12:45 +0000 (05:12 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 9 Feb 2023 15:40:43 +0000 (15:40 +0000)
commit02b187856bc7f1d7edd46897e2f983a65a97230c
tree5b96a1c2bae31c9333e0da1d25208433f967178c
parent0da7bbd5ecc578ee13d75a31c4627070c69c875f
Allow `RoutingMessageHandler` to signal backpressure

Now that we allow `handle_channel_announcement` to (indirectly)
spawn async tasks which will complete later, we have to ensure it
can apply backpressure all the way up to the TCP socket to ensure
we don't end up with too many buffers allocated for UTXO
validation.

We do this by adding a new method to `RoutingMessageHandler` which
allows it to signal if there are "many" checks pending and
`channel_announcement` messages should be delayed. The actual
`PeerManager` implementation thereof is done in the next commit.
lightning-net-tokio/src/lib.rs
lightning/src/ln/msgs.rs
lightning/src/ln/peer_handler.rs
lightning/src/routing/gossip.rs
lightning/src/routing/utxo.rs
lightning/src/util/test_utils.rs