From: Matt Corallo Date: Wed, 15 Feb 2023 06:29:29 +0000 (+0000) Subject: Add a further debug_assert that disconnecting peers are connected X-Git-Tag: v0.0.114-beta~11^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=0f07d5c0b0b594690c77eb7d526a7afa38329b03;p=rust-lightning Add a further debug_assert that disconnecting peers are connected --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 845e50f7b..1831cf057 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -6318,7 +6318,7 @@ where debug_assert!(peer_state.is_connected, "A disconnected peer cannot disconnect"); peer_state.is_connected = false; peer_state.ok_to_remove(true) - } else { true } + } else { debug_assert!(false, "Unconnected peer disconnected"); true } }; if remove_peer { per_peer_state.remove(counterparty_node_id); diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index b4cb379c4..4fce8198d 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -351,7 +351,7 @@ fn no_pending_leak_on_initial_send_failure() { let (route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[1], 100_000); nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id(), false); - nodes[1].node.peer_disconnected(&nodes[1].node.get_our_node_id(), false); + nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false); unwrap_send_err!(nodes[0].node.send_payment(&route, payment_hash, &Some(payment_secret), PaymentId(payment_hash.0)), true, APIError::ChannelUnavailable { ref err },