]> git.bitcoin.ninja Git - rust-lightning/commit
Set `counterparty_node_id` on `ChannelMonitor`s as they're updated
authorMatt Corallo <git@bluematt.me>
Wed, 29 Nov 2023 21:59:38 +0000 (21:59 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 12 Dec 2023 02:08:36 +0000 (02:08 +0000)
commit07b5355b7573cfb8ee46769286dbd0eeb6d42ec9
treeab730774fa47fecc98aae28c9c17b34bdd74fa9e
parent9488a1c98d30b8ca9db0197c8dd05f454f69caeb
Set `counterparty_node_id` on `ChannelMonitor`s as they're updated

Historically, `ChannelMonitor`s had idea who their counterparty
was. This was fine, until `ChannelManager` started indexing by
peer, at which point it needed to know the counterparty when it saw
a `ChannelMonitorUpdate` complete. To address this, a "temporary"
map from channel ID to peer was added, but no upgrade path was
created for existing `ChannelMonitor`s to not rely on this map.

This commit adds such an upgrade path, setting the
`counterparty_node_id` on all `ChannelMonitor`s as they're updated,
allowing us to eventually break backwards compatibility and remove
`ChannelManager::outpoint_to_peer`.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs