Merge branch '2020-06-refactor-chain-listener-move-chainmonitor' into 2020-06-refacto...
[rust-lightning] / fuzz / src / chanmon_consistency.rs
index 86265dfe3dd34371ca4d1dc204d01c47c40215af..1650e2e25f7060fa8c63c568257983784bcbe721 100644 (file)
@@ -30,7 +30,8 @@ use bitcoin::hash_types::{BlockHash, WPubkeyHash};
 
 use lightning::chain;
 use lightning::chain::chainmonitor;
-use lightning::chain::chainmonitor::{ChannelMonitor, ChannelMonitorUpdateErr, MonitorEvent};
+use lightning::chain::channelmonitor;
+use lightning::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdateErr, MonitorEvent};
 use lightning::chain::transaction::OutPoint;
 use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator};
 use lightning::chain::keysinterface::{KeysInterface, InMemoryChannelKeys};
@@ -84,7 +85,7 @@ impl Writer for VecWriter {
 struct TestChainMonitor {
        pub logger: Arc<dyn Logger>,
        pub chain_monitor: Arc<chainmonitor::ChainMonitor<EnforcingChannelKeys, Arc<dyn chain::Filter>, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>>>,
-       pub update_ret: Mutex<Result<(), chainmonitor::ChannelMonitorUpdateErr>>,
+       pub update_ret: Mutex<Result<(), channelmonitor::ChannelMonitorUpdateErr>>,
        // If we reload a node with an old copy of ChannelMonitors, the ChannelManager deserialization
        // logic will automatically force-close our channels for us (as we don't have an up-to-date
        // monitor implying we are not able to punish misbehaving counterparties). Because this test
@@ -107,7 +108,7 @@ impl TestChainMonitor {
 impl chain::Watch for TestChainMonitor {
        type Keys = EnforcingChannelKeys;
 
-       fn watch_channel(&self, funding_txo: OutPoint, monitor: chainmonitor::ChannelMonitor<EnforcingChannelKeys>) -> Result<(), chainmonitor::ChannelMonitorUpdateErr> {
+       fn watch_channel(&self, funding_txo: OutPoint, monitor: channelmonitor::ChannelMonitor<EnforcingChannelKeys>) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
                let mut ser = VecWriter(Vec::new());
                monitor.write_for_disk(&mut ser).unwrap();
                if let Some(_) = self.latest_monitors.lock().unwrap().insert(funding_txo, (monitor.get_latest_update_id(), ser.0)) {
@@ -118,13 +119,13 @@ impl chain::Watch for TestChainMonitor {
                self.update_ret.lock().unwrap().clone()
        }
 
-       fn update_channel(&self, funding_txo: OutPoint, update: chainmonitor::ChannelMonitorUpdate) -> Result<(), chainmonitor::ChannelMonitorUpdateErr> {
+       fn update_channel(&self, funding_txo: OutPoint, update: channelmonitor::ChannelMonitorUpdate) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
                let mut map_lock = self.latest_monitors.lock().unwrap();
                let mut map_entry = match map_lock.entry(funding_txo) {
                        hash_map::Entry::Occupied(entry) => entry,
                        hash_map::Entry::Vacant(_) => panic!("Didn't have monitor on update call"),
                };
-               let mut deserialized_monitor = <(BlockHash, chainmonitor::ChannelMonitor<EnforcingChannelKeys>)>::
+               let mut deserialized_monitor = <(BlockHash, channelmonitor::ChannelMonitor<EnforcingChannelKeys>)>::
                        read(&mut Cursor::new(&map_entry.get().1)).unwrap().1;
                deserialized_monitor.update_monitor(update.clone(), &&TestBroadcaster {}, &self.logger).unwrap();
                let mut ser = VecWriter(Vec::new());