Add gossip_queries methods to RoutingMessageHandler trait
[rust-lightning] / lightning / src / util / test_utils.rs
index 5e6b5fff53c7de5f8282694364f696df293245f3..55353c0f26be81bf107267ae083990bfd5da27c8 100644 (file)
@@ -87,7 +87,7 @@ impl<'a> chain::Watch for TestChainMonitor<'a> {
                // At every point where we get a monitor update, we should be able to send a useful monitor
                // to a watchtower and disk...
                let mut w = TestVecWriter(Vec::new());
-               monitor.write_for_disk(&mut w).unwrap();
+               monitor.serialize_for_disk(&mut w).unwrap();
                let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(
                        &mut ::std::io::Cursor::new(&w.0)).unwrap().1;
                assert!(new_monitor == monitor);
@@ -120,7 +120,7 @@ impl<'a> chain::Watch for TestChainMonitor<'a> {
                let monitors = self.chain_monitor.monitors.lock().unwrap();
                let monitor = monitors.get(&funding_txo).unwrap();
                w.0.clear();
-               monitor.write_for_disk(&mut w).unwrap();
+               monitor.serialize_for_disk(&mut w).unwrap();
                let new_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::read(
                        &mut ::std::io::Cursor::new(&w.0)).unwrap().1;
                assert!(new_monitor == *monitor);
@@ -319,6 +319,36 @@ impl msgs::RoutingMessageHandler for TestRoutingMessageHandler {
        fn should_request_full_sync(&self, _node_id: &PublicKey) -> bool {
                self.request_full_sync.load(Ordering::Acquire)
        }
+
+       fn query_channel_range(&self, _their_node_id: &PublicKey, _chain_hash: BlockHash, _first_blocknum: u32, _number_of_blocks: u32) -> Result<(), msgs::LightningError> {
+               Ok(())
+       }
+
+       fn query_short_channel_ids(&self, _their_node_id: &PublicKey, _chain_hash: BlockHash, _short_channel_ids: Vec<u64>) -> Result<(), msgs::LightningError> {
+               Ok(())
+       }
+
+       fn handle_reply_channel_range(&self, _their_node_id: &PublicKey, _msg: &msgs::ReplyChannelRange) -> Result<(), msgs::LightningError> {
+               Ok(())
+       }
+
+       fn handle_reply_short_channel_ids_end(&self, _their_node_id: &PublicKey, _msg: &msgs::ReplyShortChannelIdsEnd) -> Result<(), msgs::LightningError> {
+               Ok(())
+       }
+
+       fn handle_query_channel_range(&self, _their_node_id: &PublicKey, _msg: &msgs::QueryChannelRange) -> Result<(), msgs::LightningError> {
+               Ok(())
+       }
+
+       fn handle_query_short_channel_ids(&self, _their_node_id: &PublicKey, _msg: &msgs::QueryShortChannelIds) -> Result<(), msgs::LightningError> {
+               Ok(())
+       }
+}
+
+impl events::MessageSendEventsProvider for TestRoutingMessageHandler {
+       fn get_and_clear_pending_msg_events(&self) -> Vec<events::MessageSendEvent> {
+               vec![]
+       }
 }
 
 pub struct TestLogger {