]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Add a further debug_assert that disconnecting peers are connected
authorMatt Corallo <git@bluematt.me>
Wed, 15 Feb 2023 06:29:29 +0000 (06:29 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 21 Feb 2023 18:54:52 +0000 (18:54 +0000)
lightning/src/ln/channelmanager.rs
lightning/src/ln/payment_tests.rs

index 845e50f7bb51cac9e85aaeaae6784ed8c3487a0c..1831cf0576f933979e5b0720930d1b58d65cd2e7 100644 (file)
@@ -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);
index b4cb379c4adf17c32911a92e584cb040cbc4fe63..4fce8198defc4852b95bad89463f119db17df600 100644 (file)
@@ -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 },