X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-persister%2Fsrc%2Flib.rs;h=ef914700a16302c0e5dacad1414d3e0e8c1eb03c;hb=60f7977ea84b2092531d44abd471a19aac768ea7;hp=558f4b8fe3cee9d56b75b2230f203ccca6608e9c;hpb=4b77ce195944a87fa2f14735ccbd9f3f9ecac4d9;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() {