Merge pull request #1777 from lexe-tech/max/best-block-header-best-block
[rust-lightning] / fuzz / src / utils / test_persister.rs
index 9cb5b60b6a851f2546513fe4697336c690ab7229..44675fa787294b4a63144c9a2cddfacc4b9b33a6 100644 (file)
@@ -1,14 +1,20 @@
-use lightning::chain::channelmonitor;
+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;
 
-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<EnforcingSigner> for TestPersister {
+       fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>, _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 update_persisted_channel(&self, _funding_txo: OutPoint, _update: &Option<channelmonitor::ChannelMonitorUpdate>, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
+               self.update_ret.lock().unwrap().clone()
        }
 }