]> git.bitcoin.ninja Git - rust-lightning/commit
Always remove disconnected peers with no channels
authorViktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com>
Tue, 17 Jan 2023 23:28:00 +0000 (00:28 +0100)
committerViktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com>
Tue, 14 Feb 2023 14:04:30 +0000 (15:04 +0100)
commit6ffd02237fc06f86a4a639eea0f1f470dc8f7d59
treeaf108c187514bcaac0b993fb65f29a3e57fa0b8e
parent3d38364173ea424345aacbb8e99f6702b01dade3
Always remove disconnected peers with no channels

When a peer disconnects but still has channels, the peer's `peer_state`
entry in the `per_peer_state` is not removed by the `peer_disconnected`
function. If the channels with that peer is later closed while still
being disconnected (i.e. force closed), we therefore need to remove the
peer from `peer_state` separately.

To remove the peers separately, we push such peers to a separate HashSet
that holds peers awaiting removal, and remove the peers on a timer to
limit the negative effects on parallelism as much as possible.
lightning/src/ln/channelmanager.rs