bitcoind: don't try to match bitcoind's error string when loading wallet
The functional tests uncovered another error. And trying to pattern match any error is brittle. Just explicitly let anything through.
This commit is contained in:
parent
096ad68c4b
commit
cea72d8a63
@ -418,27 +418,14 @@ impl BitcoinD {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn maybe_load_watchonly_wallet(&self) -> Result<(), BitcoindError> {
|
||||
match self.make_fallible_node_request(
|
||||
/// Try to load the watchonly wallet in bitcoind. It will continue on error (since it's
|
||||
/// likely the wallet is just already loaded) and log it as info instead.
|
||||
pub fn try_load_watchonly_wallet(&self) {
|
||||
if let Err(e) = self.make_fallible_node_request(
|
||||
"loadwallet",
|
||||
¶ms!(Json::String(self.watchonly_wallet_path.clone()),),
|
||||
) {
|
||||
Err(e) => {
|
||||
if e.to_string().contains("is already loaded") {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
Ok(res) => {
|
||||
if let Some(warning) = res.get("warning").map(Json::as_str).flatten() {
|
||||
Err(BitcoindError::WalletLoading(warning.to_string()))
|
||||
} else if res.get("name").is_none() {
|
||||
Err(BitcoindError::WalletLoading(res.to_string()))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
log::info!("Got error '{}' while trying to load watchonly on bitcoind. It is possibly already loaded.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@ impl DaemonHandle {
|
||||
bitcoind.create_watchonly_wallet(&config.main_descriptor)?;
|
||||
log::info!("Created a new watchonly wallet on bitcoind.");
|
||||
}
|
||||
bitcoind.maybe_load_watchonly_wallet()?;
|
||||
bitcoind.try_load_watchonly_wallet();
|
||||
bitcoind.sanity_check(&config.main_descriptor, config.bitcoind_config.network)?;
|
||||
bitcoind.with_retry_limit(None);
|
||||
log::info!("Connection to bitcoind established and checked.");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user