f02f8587af83fc098d897fe0f57d37cfc9637c0a
[rust-lightning] / fuzz / src / utils / test_persister.rs
1 use lightning::chain;
2 use lightning::chain::{chainmonitor, channelmonitor};
3 use lightning::chain::transaction::OutPoint;
4 use lightning::util::enforcing_trait_impls::EnforcingSigner;
5
6 use std::sync::Mutex;
7
8 pub struct TestPersister {
9         pub update_ret: Mutex<Result<(), chain::ChannelMonitorUpdateErr>>,
10 }
11 impl chainmonitor::Persist<EnforcingSigner> for TestPersister {
12         fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), chain::ChannelMonitorUpdateErr> {
13                 self.update_ret.lock().unwrap().clone()
14         }
15
16         fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: &channelmonitor::ChannelMonitorUpdate, _data: &channelmonitor::ChannelMonitor<EnforcingSigner>) -> Result<(), chain::ChannelMonitorUpdateErr> {
17                 self.update_ret.lock().unwrap().clone()
18         }
19 }