fix(account) account discovery process returning LatestAccountIsEmpty
@@ -118,12 +118,15 @@ impl<'a> AccountInitialiser<'a> {
let created_at_timestamp: u128 = created_at.timestamp().try_into().unwrap(); // safe to unwrap since it's > 0
let mnemonic = self.mnemonic;
+ // check for empty latest account only when not skipping persistance (account discovery process)
+ if !self.skip_persistance {
if let Some(latest_account) = accounts.last() {
let latest_account: Account = serde_json::from_str(&latest_account)?;
if latest_account.messages().is_empty() && latest_account.total_balance() == 0 {
return Err(crate::WalletError::LatestAccountIsEmpty);
}
}
+ }
let stronghold_account_res: crate::Result<stronghold::Account> =
crate::with_stronghold_from_path(&self.storage_path, |stronghold| {
