]> git.bitcoin.ninja Git - rust-lightning/blob - fuzz/src/utils/test_persister.rs
Merge pull request #2699 from mhrheaume/mhr/temporary_channel_id
[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::test_channel_signer::TestChannelSigner;
6
7 use std::sync::Mutex;
8
9 pub struct TestPersister {
10         pub update_ret: Mutex<chain::ChannelMonitorUpdateStatus>,
11 }
12 impl chainmonitor::Persist<TestChannelSigner> for TestPersister {
13         fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<TestChannelSigner>, _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<TestChannelSigner>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
18                 self.update_ret.lock().unwrap().clone()
19         }
20 }