diff --git a/Cargo.lock b/Cargo.lock index 5db0d51fa..65b172e10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15238,12 +15238,12 @@ dependencies = [ "pkg-config", ] -[[patch.unused]] -name = "orml-xcm" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack//open-runtime-module-library?rev=24f0a8b6e04e1078f70d0437fb816337cdf4f64c#24f0a8b6e04e1078f70d0437fb816337cdf4f64c" - [[patch.unused]] name = "sp-serializer" version = "4.0.0-dev" source = "git+https://github.com/paritytech//substrate?branch=polkadot-v0.9.36#cb4f2491b00af7d7817f3a54209c26b20faa1f51" + +[[patch.unused]] +name = "orml-xcm" +version = "0.4.1-dev" +source = "git+https://github.com/open-web3-stack//open-runtime-module-library?rev=24f0a8b6e04e1078f70d0437fb816337cdf4f64c#24f0a8b6e04e1078f70d0437fb816337cdf4f64c" diff --git a/bitcoin/src/error.rs b/bitcoin/src/error.rs index eadde1b63..321198a51 100644 --- a/bitcoin/src/error.rs +++ b/bitcoin/src/error.rs @@ -95,6 +95,18 @@ impl Error { ) } + pub fn is_already_loading_wallet_error(&self) -> bool { + // Catch this error: `JSON-RPC error: RPC error response: RpcError { code: -4, message: "Wallet already + // loading.", data: None }`. + // In older versions, the message was "Wallet already being loading.". See https://github.com/bitcoin/bitcoin/commit/ae9d26a8f0435e2f4b39ad1181473e6575ac67b5 + // We catch everything that starts with "Wallet already". As of the time of writing no error error messages + // start with that + matches!(self, + Error::BitcoinError(BitcoinError::JsonRpc(JsonRpcError::Rpc(err))) + if BitcoinRpcError::from(err.clone()) == BitcoinRpcError::RpcWalletError && err.message.starts_with("Wallet already") + ) + } + pub fn rejected_by_network_rules(&self) -> bool { matches!(self, Error::BitcoinError(BitcoinError::JsonRpc(JsonRpcError::Rpc(err))) diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index df81f429b..4cc12b31e 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -539,7 +539,9 @@ impl BitcoinCore { match call().await.map_err(Error::from) { Err(inner) if inner.is_transport_error() && time.elapsed() >= TRANSPORT_TIMEOUT => { info!("Call timed out - retrying..."); - // timeout - retry again + } + Err(inner) if inner.is_already_loading_wallet_error() => { + info!("Wallet is already loading - retrying..."); } result => return result, }; @@ -961,7 +963,9 @@ impl BitcoinCoreApi for BitcoinCore { info!("Loading wallet {wallet_name}..."); let result = self.rpc.load_wallet(wallet_name)?; if let Some(warning) = result.warning { - warn!("Received error while loading wallet {wallet_name}: {warning}"); + if !warning.is_empty() { + warn!("Received error while loading wallet {wallet_name}: {warning}"); + } } } else { info!("Creating wallet {wallet_name}...");