Skip to content

Commit

Permalink
undid breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
Brord van Wierst committed Sep 11, 2023
1 parent bdcbde6 commit 482fe51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cli/src/command/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ pub async fn restore_command(storage_path: &Path, snapshot_path: &Path, backup_p
let mut builder = Wallet::builder();
if check_file_exists(snapshot_path).await.is_ok() {
println_log_info!(
"Detected a stronghold file at {}, requiring unlock..",
"Detected a stronghold file at {}. Enter password to unlock:",
snapshot_path.to_str().unwrap()
);
let password = get_password("Detected Stronghold password", false)?;
let password = get_password("Stronghold password", false)?;
let secret_manager = SecretManager::Stronghold(
StrongholdSecretManager::builder()
.password(password.clone())
Expand Down
3 changes: 0 additions & 3 deletions sdk/src/client/stronghold/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ pub enum Error {
/// Path already exists
#[error("path already exists: {0}")]
PathAlreadyExists(std::path::PathBuf),
/// Path is not a file
#[error("path is not a file: {0}")]
PathIsNotFile(std::path::PathBuf),
/// Io error
#[error("io error: {0}")]
Io(#[from] std::io::Error),
Expand Down
8 changes: 6 additions & 2 deletions sdk/src/client/stronghold/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ impl StrongholdAdapterBuilder {
/// [`timeout()`]: Self::timeout()
pub fn build<P: AsRef<Path>>(self, snapshot_path: P) -> Result<StrongholdAdapter, Error> {
if snapshot_path.as_ref().is_dir() {
return Err(Error::PathIsNotFile(snapshot_path.as_ref().to_path_buf()));
// TODO: Add Error in 2.0 as its breaking. Will crash further down now.
// Issue #1197
// return Err(Error::PathIsNotFile(snapshot_path.as_ref().to_path_buf()));
}

// In any case, Stronghold - as a necessary component - needs to be present at this point.
Expand Down Expand Up @@ -490,7 +492,9 @@ impl StrongholdAdapter {
pub async fn write_stronghold_snapshot(&self, snapshot_path: Option<&Path>) -> Result<(), Error> {
if let Some(p) = snapshot_path {
if p.is_dir() {
return Err(Error::PathIsNotFile(p.to_path_buf()));
// TODO: Add Error in 2.0 as its breaking. Will crash further down now.
// Issue #1197
// return Err(Error::PathIsNotFile(p.to_path_buf()));
}
}

Expand Down

0 comments on commit 482fe51

Please sign in to comment.