bitcoind: immediately set the default retry limit

We were previously adding it later on to fail early on startup error.
This didn't handle well "warming up" errors.

Now that it was reachable and listening to requests already, we can just
use the real retry limit from the get-go.
This commit is contained in:
Antoine Poinsot 2022-12-08 11:26:11 +01:00
parent b0ef121e91
commit 13b2b8eef4
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
2 changed files with 2 additions and 8 deletions

View File

@ -245,7 +245,7 @@ impl BitcoinD {
sendonly_client,
watchonly_client,
watchonly_wallet_path,
retries: 0,
retries: BITCOIND_RETRY_LIMIT,
})
}
@ -270,12 +270,6 @@ impl BitcoinD {
Ok(())
}
/// Set how many times we'll retry a failed request. If passed None will set to default.
pub fn with_retry_limit(mut self, retry_limit: Option<usize>) -> Self {
self.retries = retry_limit.unwrap_or(BITCOIND_RETRY_LIMIT);
self
}
/// Wrapper to retry a request sent to bitcoind upon IO failure
/// according to the configured number of retries.
fn retry<T, R: Fn() -> Result<T, BitcoindError>>(

View File

@ -207,7 +207,7 @@ fn setup_bitcoind(
bitcoind.sanity_check(&config.main_descriptor, config.bitcoin_config.network)?;
log::info!("Connection to bitcoind established and checked.");
Ok(bitcoind.with_retry_limit(None))
Ok(bitcoind)
}
#[derive(Clone)]