]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Connect nodes in remaining tests
authorJeffrey Czyz <jkczyz@gmail.com>
Sat, 31 Jul 2021 14:32:27 +0000 (09:32 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Mon, 9 Aug 2021 20:55:26 +0000 (15:55 -0500)
Similar to 2745bd5ac776c48950bcb630338538d31a9615d0, this ensures that
ChannelManager knows about the features its peers.

fuzz/src/chanmon_consistency.rs
lightning-background-processor/src/lib.rs
lightning/src/ln/channelmanager.rs

index 17230a83500c383f2da5f10a963088f56008858e..f26b3bf547964e66f9437cc8b52f6922a4490507 100644 (file)
@@ -396,6 +396,9 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
        let mut channel_txn = Vec::new();
        macro_rules! make_channel {
                ($source: expr, $dest: expr, $chan_id: expr) => { {
+                       $source.peer_connected(&$dest.get_our_node_id(), &Init { features: InitFeatures::known() });
+                       $dest.peer_connected(&$source.get_our_node_id(), &Init { features: InitFeatures::known() });
+
                        $source.create_channel($dest.get_our_node_id(), 100_000, 42, 0, None).unwrap();
                        let open_channel = {
                                let events = $source.get_and_clear_pending_msg_events();
index 55ac14c048c412e8a9d0a7f17318d62b7569b3f6..7c1da8cd9d3a1178e00a98eb7bfcf9cb09b00246 100644 (file)
@@ -223,7 +223,7 @@ mod tests {
        use lightning::get_event_msg;
        use lightning::ln::channelmanager::{BREAKDOWN_TIMEOUT, ChainParameters, ChannelManager, SimpleArcChannelManager};
        use lightning::ln::features::InitFeatures;
-       use lightning::ln::msgs::ChannelMessageHandler;
+       use lightning::ln::msgs::{ChannelMessageHandler, Init};
        use lightning::ln::peer_handler::{PeerManager, MessageHandler, SocketDescriptor};
        use lightning::util::config::UserConfig;
        use lightning::util::events::{Event, MessageSendEventsProvider, MessageSendEvent};
@@ -297,6 +297,14 @@ mod tests {
                        let node = Node { node: manager, peer_manager, chain_monitor, persister, tx_broadcaster, logger, best_block };
                        nodes.push(node);
                }
+
+               for i in 0..num_nodes {
+                       for j in (i+1)..num_nodes {
+                               nodes[i].node.peer_connected(&nodes[j].node.get_our_node_id(), &Init { features: InitFeatures::known() });
+                               nodes[j].node.peer_connected(&nodes[i].node.get_our_node_id(), &Init { features: InitFeatures::known() });
+                       }
+               }
+
                nodes
        }
 
index afbfd0ee970da43bc050c488281cf16da4c4e8c7..8c9d885fb2d56588d87fcadc651a23ec9076471b 100644 (file)
@@ -5559,7 +5559,7 @@ pub mod bench {
        use ln::channelmanager::{BestBlock, ChainParameters, ChannelManager, PaymentHash, PaymentPreimage};
        use ln::features::{InitFeatures, InvoiceFeatures};
        use ln::functional_test_utils::*;
-       use ln::msgs::ChannelMessageHandler;
+       use ln::msgs::{ChannelMessageHandler, Init};
        use routing::network_graph::NetworkGraph;
        use routing::router::get_route;
        use util::test_utils;
@@ -5622,6 +5622,8 @@ pub mod bench {
                });
                let node_b_holder = NodeHolder { node: &node_b };
 
+               node_a.peer_connected(&node_b.get_our_node_id(), &Init { features: InitFeatures::known() });
+               node_b.peer_connected(&node_a.get_our_node_id(), &Init { features: InitFeatures::known() });
                node_a.create_channel(node_b.get_our_node_id(), 8_000_000, 100_000_000, 42, None).unwrap();
                node_b.handle_open_channel(&node_a.get_our_node_id(), InitFeatures::known(), &get_event_msg!(node_a_holder, MessageSendEvent::SendOpenChannel, node_b.get_our_node_id()));
                node_a.handle_accept_channel(&node_b.get_our_node_id(), InitFeatures::known(), &get_event_msg!(node_b_holder, MessageSendEvent::SendAcceptChannel, node_a.get_our_node_id()));