Skip to content

Commit

Permalink
Merge #1274
Browse files Browse the repository at this point in the history
1274: fix: add debug log for opening monero wallet error r=delta1 a=delta1

see issue #1273 

Co-authored-by: Byron Hambly <[email protected]>
  • Loading branch information
bors[bot] and delta1 authored Jan 10, 2023
2 parents b75b3e6 + 9346cb7 commit ab5d4a1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions swap/src/monero/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)?;

tracing::debug!(monero_wallet_name = %name, "Created Monero wallet");
} else {
tracing::debug!(monero_wallet_name = %name, "Opened Monero wallet");
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");
}
Ok(_) => tracing::debug!(monero_wallet_name = %name, "Opened Monero wallet"),
}

Self::connect(client, name, env_config).await
Expand Down

0 comments on commit ab5d4a1

Please sign in to comment.