]> git.bitcoin.ninja Git - rust-lightning/commit
Store override counterparty handshake limits until we enforce them 2022-02-override-handshake-limits
authorMatt Corallo <git@bluematt.me>
Tue, 1 Feb 2022 21:16:27 +0000 (21:16 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 1 Feb 2022 21:40:56 +0000 (21:40 +0000)
commit649af07205748358c6996a848e7e399e6be31d88
tree437fa0bb4c0ff4c48acfce5869cb90f795369994
parent482a2b9250679abb3c9931497b2324799fbfa087
Store override counterparty handshake limits until we enforce them

We currently allow users to provide an `override_config` in
`ChannelManager::create_channel` which it seems should apply to the
channel. However, because we don't store any of it, the only parts
which we apply to the channel are those which are set in the
`Channel` object immediately in `Channel::new_outbound` and used
from there.

This is great in most cases, however the
`UserConfig::peer_channel_config_limits` `ChannelHandshakeLimits`
object is used in `accept_channel` to bound what is acceptable in
our peer's `AcceptChannel` message. Thus, for outbound channels, we
are given a full `UserConfig` object to "override" the default
config, but we don't use any of the handshake limits specified in
it.

Here, we move to storing the `ChannelHandshakeLimits` explicitly
and applying it when we receive our peer's `AcceptChannel`. Note
that we don't need to store it anywhere because if we haven't
received an `AcceptChannel` from our peer when we reload from disk
we will forget the channel entirely anyway.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs