Remove peers from the `node_id_to_descriptor` even without init
authorMatt Corallo <git@bluematt.me>
Tue, 28 Feb 2023 21:28:13 +0000 (21:28 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 28 Feb 2023 21:40:20 +0000 (21:40 +0000)
commit2c15bb437eeab20cc3cfd33026546b4337933550
tree1eae60fe51cee85f7644eda1dd426670c6ec5052
parent8311581fe110a9ee561a6fda6b55c78a02068d43
Remove peers from the `node_id_to_descriptor` even without init

When a peer has finished the noise handshake, but has not yet
completed the lightning `Init`-based handshake, they will be
present in the `node_id_to_descriptor` set, even though
`Peer::handshake_complete()` returns false. Thus, when we go to
disconnect such a peer, we must ensure that we remove it from the
descriptor set as well.

Failing to do so caused an `Inconsistent peers set state!` panic in
the C bindings network handler.
lightning/src/ln/peer_handler.rs