Return error if specified Monero account doesn't exist

This commit is contained in:
silverpill 2023-04-14 18:28:18 +00:00
parent d368661d08
commit 27f048c3d2
2 changed files with 8 additions and 0 deletions

View file

@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Ignore errors when importing activities from outbox.
- Make activity limit in outbox fetcher adjustable.
- Changed `reset-subscriptions` command arguments (removes subscription options by default).
- Return error if specified Monero account doesn't exist.
## [1.21.0] - 2023-04-12

View file

@ -87,6 +87,13 @@ pub async fn open_monero_wallet(
return Err(error.into());
};
};
// Verify account exists
let account_exists = wallet_client.get_accounts(None).await?
.subaddress_accounts.into_iter()
.any(|account| account.account_index == config.account_index);
if !account_exists {
return Err(MoneroError::WalletRpcError("account doesn't exist"));
};
Ok(wallet_client)
}