diff --git a/src/sweep.rs b/src/sweep.rs index 15da689..decaca0 100644 --- a/src/sweep.rs +++ b/src/sweep.rs @@ -1,5 +1,5 @@ use std::io::{Read, Seek, SeekFrom}; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::sync::Arc; use std::{fs, io}; @@ -28,6 +28,14 @@ pub(crate) async fn migrate_deprecated_spendable_outputs( let processing_spendables_dir = format!("{}/processing_spendable_outputs", ldk_data_dir); let spendables_dir = format!("{}/spendable_outputs", ldk_data_dir); + if !Path::new(&pending_spendables_dir).exists() + && !Path::new(&processing_spendables_dir).exists() + && !Path::new(&spendables_dir).exists() + { + lightning::log_info!(&*logger, "No deprecated spendable outputs to migrate, returning"); + return; + } + if let Ok(dir_iter) = fs::read_dir(&pending_spendables_dir) { // Move any spendable descriptors from pending folder so that we don't have any // races with new files being added.