`rustfmt`: `fuzz/src/fromstr_to_netaddress.rs`
[rust-lightning] / fuzz / src / utils / test_persister.rs
index 9cb5b60b6a851f2546513fe4697336c690ab7229..a99c397d0b2341c8c4b8b6d76b1f13a345c85540 100644 (file)
@@ -1,14 +1,22 @@
-use lightning::chain::channelmonitor;
+use lightning::chain;
+use lightning::chain::{chainmonitor, channelmonitor};
 use lightning::chain::transaction::OutPoint;
-use lightning::util::enforcing_trait_impls::EnforcingSigner;
+use lightning::util::test_channel_signer::TestChannelSigner;
 
-pub struct TestPersister {}
-impl channelmonitor::Persist<EnforcingSigner> for TestPersister {
-       fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
-               Ok(())
+use std::sync::Mutex;
+
+pub struct TestPersister {
+       pub update_ret: Mutex<chain::ChannelMonitorUpdateStatus>,
+}
+impl chainmonitor::Persist<TestChannelSigner> for TestPersister {
+       fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<TestChannelSigner>) -> chain::ChannelMonitorUpdateStatus {
+               self.update_ret.lock().unwrap().clone()
+       }
+
+       fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: Option<&channelmonitor::ChannelMonitorUpdate>, _data: &channelmonitor::ChannelMonitor<TestChannelSigner>) -> chain::ChannelMonitorUpdateStatus {
+               self.update_ret.lock().unwrap().clone()
        }
 
-       fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: &channelmonitor::ChannelMonitorUpdate, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
-               Ok(())
+       fn archive_persisted_channel(&self, _: OutPoint) {
        }
 }