- fn get_and_clear_pending_monitor_events(&self) -> Vec<MonitorEvent> {
- return self.simple_monitor.get_and_clear_pending_monitor_events();
+ fn release_pending_monitor_events(&self) -> Vec<MonitorEvent> {
+ return self.chain_monitor.release_pending_monitor_events();
+ }
+}
+
+pub struct TestPersister {
+ pub update_ret: Mutex<Result<(), channelmonitor::ChannelMonitorUpdateErr>>
+}
+impl TestPersister {
+ pub fn new() -> Self {
+ Self {
+ update_ret: Mutex::new(Ok(()))
+ }
+ }
+
+ pub fn set_update_ret(&self, ret: Result<(), channelmonitor::ChannelMonitorUpdateErr>) {
+ *self.update_ret.lock().unwrap() = ret;
+ }
+}
+impl channelmonitor::Persist<EnforcingChannelKeys> for TestPersister {
+ fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<EnforcingChannelKeys>) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
+ self.update_ret.lock().unwrap().clone()
+ }
+
+ fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: &channelmonitor::ChannelMonitorUpdate, _data: &channelmonitor::ChannelMonitor<EnforcingChannelKeys>) -> Result<(), channelmonitor::ChannelMonitorUpdateErr> {
+ self.update_ret.lock().unwrap().clone()