Never generate a `BroadcastChannelUpdate` for priv channels
authorMatt Corallo <git@bluematt.me>
Fri, 11 Jun 2021 16:03:34 +0000 (16:03 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 2 Jul 2021 22:21:32 +0000 (22:21 +0000)
commit422bdcf81467451a31a6052950759a86cdf1760a
treee7272407de37781ec30d5ed687a72c23b1a76fa8
parent0c57018f2fb5618f976542a4d24adee29cf49c96
Never generate a `BroadcastChannelUpdate` for priv channels

Currently we always generate a
`MessageSendEvent::BroadcastChannelUpdate` when a channel is closed
even if the channel is private. Our immediate peers should ignore
such messages as they haven't seen a corresponding
`channel_announcement`, but we are still giving up some privacy by
informing our immediate peers of which channels were ours.

Here we split `ChannelManager::get_channel_update` into a
`get_channel_update_for_broadcast` and
`get_channel_update_for_unicast`. The first is used when we are
broadcasting a `channel_update`, allowing us to refuse to do so
for private channels. The second is used when failing a payment (in
which case the recipient has already shown that they are aware of
the channel so no such privacy concerns exist).
lightning/src/ln/channelmanager.rs