From 9346cb7baf17f56eb8dd8ace5edd98d0c9583159 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Tue, 10 Jan 2023 13:38:19 +0200 Subject: [PATCH] fix: add debug log for opening monero wallet error --- swap/src/monero/wallet.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index a8fccc5d..3f548c41 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -26,15 +26,16 @@ impl Wallet { pub async fn open_or_create(url: Url, name: String, env_config: Config) -> Result { 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