From 13b2b8eef4dd5deafe04b2330b469067afd0b12c Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Thu, 8 Dec 2022 11:26:11 +0100 Subject: [PATCH] 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. --- src/bitcoin/d/mod.rs | 8 +------- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/bitcoin/d/mod.rs b/src/bitcoin/d/mod.rs index af282dcc..2d917fc7 100644 --- a/src/bitcoin/d/mod.rs +++ b/src/bitcoin/d/mod.rs @@ -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) -> 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 Result>( diff --git a/src/lib.rs b/src/lib.rs index 5a411824..a2cb7319 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)]