X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fpersist.rs;fp=lightning%2Fsrc%2Futil%2Fpersist.rs;h=da55c38164516aa75468f7d841cdb720a61d9ac9;hb=12fa0b11a669050bc3e0e081bea0523baa1598ff;hp=d04c3430bcc90de0ec7211c4ff12be4a8e2d6bd6;hpb=313810ebdc8d7a90e68db07774cfdf7a653159e0;p=rust-lightning diff --git a/lightning/src/util/persist.rs b/lightning/src/util/persist.rs index d04c3430..da55c381 100644 --- a/lightning/src/util/persist.rs +++ b/lightning/src/util/persist.rs @@ -72,15 +72,19 @@ impl Persist for K { // A PermanentFailure implies we need to shut down since we're force-closing channels without // even broadcasting! - fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor, _update_id: MonitorUpdateId) -> Result<(), chain::ChannelMonitorUpdateErr> { + fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus { let key = format!("monitors/{}_{}", funding_txo.txid.to_hex(), funding_txo.index); - self.persist(&key, monitor) - .map_err(|_| chain::ChannelMonitorUpdateErr::PermanentFailure) + match self.persist(&key, monitor) { + Ok(()) => chain::ChannelMonitorUpdateStatus::Completed, + Err(_) => chain::ChannelMonitorUpdateStatus::PermanentFailure, + } } - fn update_persisted_channel(&self, funding_txo: OutPoint, _update: &Option, monitor: &ChannelMonitor, _update_id: MonitorUpdateId) -> Result<(), chain::ChannelMonitorUpdateErr> { + fn update_persisted_channel(&self, funding_txo: OutPoint, _update: &Option, monitor: &ChannelMonitor, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus { let key = format!("monitors/{}_{}", funding_txo.txid.to_hex(), funding_txo.index); - self.persist(&key, monitor) - .map_err(|_| chain::ChannelMonitorUpdateErr::PermanentFailure) + match self.persist(&key, monitor) { + Ok(()) => chain::ChannelMonitorUpdateStatus::Completed, + Err(_) => chain::ChannelMonitorUpdateStatus::PermanentFailure, + } } }