]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Give `ChannelManager`s `channel_udpate`s for pub chans in test
authorMatt Corallo <git@bluematt.me>
Tue, 8 Mar 2022 19:14:49 +0000 (19:14 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 8 Mar 2022 19:16:17 +0000 (19:16 +0000)
This makes tests slightly more realistic by delivering
`channel_update`s to `ChannelManager`s, ensuring we have
forwarding data stored locally for all channels, including public
ones.

lightning/src/ln/functional_test_utils.rs

index a908cd416587d8b872e821d315dcd00093a5a4e8..64cbff1158a6cf0252f45efbdd9f9e5e32a8d006 100644 (file)
@@ -748,6 +748,11 @@ pub fn update_nodes_with_chan_announce<'a, 'b, 'c, 'd>(nodes: &'a Vec<Node<'b, '
                node.net_graph_msg_handler.handle_channel_update(upd_2).unwrap();
                node.net_graph_msg_handler.handle_node_announcement(&a_node_announcement).unwrap();
                node.net_graph_msg_handler.handle_node_announcement(&b_node_announcement).unwrap();
+
+               // Note that channel_updates are also delivered to ChannelManagers to ensure we have
+               // forwarding info for local channels even if its not accepted in the network graph.
+               node.node.handle_channel_update(&nodes[a].node.get_our_node_id(), &upd_1);
+               node.node.handle_channel_update(&nodes[b].node.get_our_node_id(), &upd_2);
        }
 }