Add assertion since we now have a pub field that is PartialEq
authorMatt Corallo <git@bluematt.me>
Tue, 12 May 2020 01:08:35 +0000 (21:08 -0400)
committerMatt Corallo <git@bluematt.me>
Tue, 12 May 2020 18:02:40 +0000 (14:02 -0400)
We previously were only able to assert that the route graph
serialization roundtrips were good by comparing the network
messages returned from them, but we can now do better as the graph
is exposed publicly via a simple datastructure that implements
PartialEq.

lightning/src/ln/functional_test_utils.rs

index 28197d670ead55ca5cea390217694a75ac4200fb..e4009cbf23302c37af5bdefb1b1a3b94da985bd9 100644 (file)
@@ -102,6 +102,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
                                let network_graph_ser = self.net_graph_msg_handler.network_graph.read().unwrap();
                                network_graph_ser.write(&mut w).unwrap();
                                let network_graph_deser = <NetworkGraph>::read(&mut ::std::io::Cursor::new(&w.0)).unwrap();
                                let network_graph_ser = self.net_graph_msg_handler.network_graph.read().unwrap();
                                network_graph_ser.write(&mut w).unwrap();
                                let network_graph_deser = <NetworkGraph>::read(&mut ::std::io::Cursor::new(&w.0)).unwrap();
+                               assert!(network_graph_deser == *self.net_graph_msg_handler.network_graph.read().unwrap());
                                let net_graph_msg_handler = NetGraphMsgHandler::from_net_graph(
                                   Arc::clone(&self.chain_monitor) as Arc<chaininterface::ChainWatchInterface>,
                                   Arc::clone(&self.logger) as Arc<Logger>, RwLock::new(network_graph_deser)
                                let net_graph_msg_handler = NetGraphMsgHandler::from_net_graph(
                                   Arc::clone(&self.chain_monitor) as Arc<chaininterface::ChainWatchInterface>,
                                   Arc::clone(&self.logger) as Arc<Logger>, RwLock::new(network_graph_deser)