1274: fix: add debug log for opening monero wallet error r=delta1 a=delta1

see issue #1273 

Co-authored-by: Byron Hambly <bhambly@blockstream.com>
This commit is contained in:
bors[bot] 2023-01-10 11:50:21 +00:00 committed by GitHub
commit ab5d4a1ed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,15 +26,16 @@ impl Wallet {
pub async fn open_or_create(url: Url, name: String, env_config: Config) -> Result<Self> {
let client = wallet::Client::new(url)?;
let open_wallet_response = client.open_wallet(name.clone()).await;
if open_wallet_response.is_err() {
client.create_wallet(name.clone(), "English".to_owned()).await.context(
"Unable to create Monero wallet, please ensure that the monero-wallet-rpc is available",
)?;
match client.open_wallet(name.clone()).await {
Err(error) => {
tracing::debug!(%error, "Open wallet response error");
client.create_wallet(name.clone(), "English".to_owned()).await.context(
"Unable to create Monero wallet, please ensure that the monero-wallet-rpc is available",
)?;
tracing::debug!(monero_wallet_name = %name, "Created Monero wallet");
} else {
tracing::debug!(monero_wallet_name = %name, "Opened Monero wallet");
tracing::debug!(monero_wallet_name = %name, "Created Monero wallet");
}
Ok(_) => tracing::debug!(monero_wallet_name = %name, "Opened Monero wallet"),
}
Self::connect(client, name, env_config).await