Skip to content

Commit

Permalink
f terminate early if no deprecated spendables present
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinewallace committed May 29, 2024
1 parent f94cbd7 commit 8f1d3ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sweep.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 8f1d3ea

Please sign in to comment.