From 80ea9a60a98e1f1f8c59bac87afe73bbf10db655 Mon Sep 17 00:00:00 2001 From: Binarybaron Date: Mon, 26 May 2025 19:02:17 +0200 Subject: [PATCH] fix(monero wallet): Check if wallet already exists by JsonRpcError Error Code --- swap/src/monero/wallet.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index 4f19acd9..49a7000b 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -152,7 +152,8 @@ impl Wallet { // we just try to open it instead match result { Ok(_) => Ok(()), - Err(error) if error.to_string().contains("Wallet already exists") => { + // See: https://github.com/monero-project/monero/blob/master/src/wallet/wallet_rpc_server_error_codes.h#L54 + Err(jsonrpc::Error::JsonRpc(jsonrpc::JsonRpcError { code: -21, .. })) => { tracing::debug!( monero_wallet_name = &file_name, "Cannot create wallet because it already exists, loading instead"