lightningdevkit / rust-lightning

A highly modular Bitcoin Lightning library written in Rust. It's rust-lightning, not Rusty's Lightning!
Other
1.15k stars 363 forks source link

`peer_disconnected` event processing isn't robust if a peer_connected Errs #3108

Open TheBlueMatt opened 3 months ago

TheBlueMatt commented 3 months ago

We guarantee that peer_disconnected will always be called for a peer after peer_connected, but we don't if one message handler fails peer_connected (the others wont even get it). Also, PeerManager::read_event isn't clear about if the user has to call back into PeerManager with a disconnection event (i think so, but we should check ldk-garbagecollected/ldk-c-bindings/ldk-net-tokio).