Merge pull request #1777 from lexe-tech/max/best-block-header-best-block
[rust-lightning] / fuzz / src / utils / test_persister.rs
1 use lightning::chain;
2 use lightning::chain::{chainmonitor, channelmonitor};
3 use lightning::chain::chainmonitor::MonitorUpdateId;
4 use lightning::chain::transaction::OutPoint;
5 use lightning::util::enforcing_trait_impls::EnforcingSigner;
6
7 use std::sync::Mutex;
8
9 pub struct TestPersister {
10         pub update_ret: Mutex<chain::ChannelMonitorUpdateStatus>,
11 }
12 impl chainmonitor::Persist<EnforcingSigner> for TestPersister {
13         fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
14                 self.update_ret.lock().unwrap().clone()
15         }
16
17         fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: &Option<channelmonitor::ChannelMonitorUpdate>, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
18                 self.update_ret.lock().unwrap().clone()
19         }
20 }