From 4366369ef5ed9de7a01783bddb97732c6a1eea5f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 18 Oct 2023 15:22:26 +0000 Subject: [PATCH] Fix race between outbound messages and peer disconnection Previously, outbound messages held in `process_events` could race with peer disconnection, allowing a message intended for a peer before disconnection to be sent to the same peer after disconnection. The fix is simple - hold the peers read lock while we fetch pending messages from peers (as we disconnect with the write lock). --- lightning/src/ln/peer_handler.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 933e7ee6b..8e91023b1 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1870,15 +1870,13 @@ impl { -- 2.39.5