X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-persister%2Fsrc%2Flib.rs;h=ef914700a16302c0e5dacad1414d3e0e8c1eb03c;hb=7714393cf00b5a7fbe29566814125305598dc656;hp=558f4b8fe3cee9d56b75b2230f203ccca6608e9c;hpb=963f8d93b58ebf5d5ee1d6e3e3654c11a4597a0f;p=rust-lightning diff --git a/lightning-persister/src/lib.rs b/lightning-persister/src/lib.rs index 558f4b8f..ef914700 100644 --- a/lightning-persister/src/lib.rs +++ b/lightning-persister/src/lib.rs @@ -3,6 +3,8 @@ #![deny(broken_intra_doc_links)] #![deny(missing_docs)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] + #![cfg_attr(all(test, feature = "_bench_unstable"), feature(test))] #[cfg(all(test, feature = "_bench_unstable"))] extern crate test; @@ -122,6 +124,12 @@ impl FilesystemPersister { "Invalid ChannelMonitor file name", )); } + if filename.unwrap().ends_with(".tmp") { + // If we were in the middle of committing an new update and crashed, it should be + // safe to ignore the update - we should never have returned to the caller and + // irrevocably committed to the new state in any way. + continue; + } let txid = Txid::from_hex(filename.unwrap().split_at(64).0); if txid.is_err() {