Add `ChainMonitor::archive_fully_resolved_monitor_channels`
[rust-lightning] / fuzz / src / utils / test_persister.rs
index 5f4a5cf718ef9e2483cd83a91c05eb9d61660952..f9a03d16178ac224bce66333d14fc8d544124310 100644 (file)
@@ -1,14 +1,23 @@
+use lightning::chain;
 use lightning::chain::{chainmonitor, channelmonitor};
+use lightning::chain::chainmonitor::MonitorUpdateId;
 use lightning::chain::transaction::OutPoint;
-use lightning::util::enforcing_trait_impls::EnforcingSigner;
+use lightning::util::test_channel_signer::TestChannelSigner;
 
-pub struct TestPersister {}
-impl chainmonitor::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>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
+               self.update_ret.lock().unwrap().clone()
+       }
+
+       fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: Option<&channelmonitor::ChannelMonitorUpdate>, _data: &channelmonitor::ChannelMonitor<TestChannelSigner>, _update_id: MonitorUpdateId) -> 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) {
        }
 }