X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=99b836665436c1876f13577993b11e440ee6c555;hb=e4e6e09b672dc929b4d8571975bd923a7a4486be;hp=43518a3fd86cf2c9e8984e953d45b657c8b3bb68;hpb=806b7f0e312c59c87fd628fb71e7c4a77a39645a;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 43518a3f..99b83666 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -450,7 +450,7 @@ impl WatchtowerPersister { } #[cfg(test)] -impl chainmonitor::Persist for WatchtowerPersister { +impl chainmonitor::Persist for WatchtowerPersister { fn persist_new_channel(&self, funding_txo: OutPoint, data: &channelmonitor::ChannelMonitor ) -> chain::ChannelMonitorUpdateStatus { @@ -513,9 +513,6 @@ pub struct TestPersister { /// The queue of update statuses we'll return. If none are queued, ::Completed will always be /// returned. pub update_rets: Mutex>, - /// When we get an update_persisted_channel call with no ChannelMonitorUpdate, we insert the - /// MonitorId here. - pub chain_sync_monitor_persistences: Mutex>, /// When we get an update_persisted_channel call *with* a ChannelMonitorUpdate, we insert the /// [`ChannelMonitor::get_latest_update_id`] here. /// @@ -526,7 +523,6 @@ impl TestPersister { pub fn new() -> Self { Self { update_rets: Mutex::new(VecDeque::new()), - chain_sync_monitor_persistences: Mutex::new(VecDeque::new()), offchain_monitor_updates: Mutex::new(new_hash_map()), } } @@ -536,7 +532,7 @@ impl TestPersister { self.update_rets.lock().unwrap().push_back(next_ret); } } -impl chainmonitor::Persist for TestPersister { +impl chainmonitor::Persist for TestPersister { fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor) -> chain::ChannelMonitorUpdateStatus { if let Some(update_ret) = self.update_rets.lock().unwrap().pop_front() { return update_ret @@ -552,22 +548,13 @@ impl chainmonitor::Persist {}, - None => { - // If the channel was not in the offchain_monitor_updates map, it should be in the - // chain_sync_monitor_persistences map. - self.chain_sync_monitor_persistences.lock().unwrap().retain(|x| x != &funding_txo); - } - }; + self.offchain_monitor_updates.lock().unwrap().remove(&funding_txo); } }