From 8598bcade11ee5ae8b0cb61d8dbf267f17882cd8 Mon Sep 17 00:00:00 2001 From: rishflab Date: Mon, 30 Aug 2021 14:43:53 +1000 Subject: [PATCH] Configure electrum client to retry 5 times --- CHANGELOG.md | 3 ++- swap/src/bitcoin/wallet.rs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b96e9cfe..89ae41d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 See issue https://github.com/comit-network/xmr-btc-swap/issues/652. - An issue where swap protocol was getting stuck trying to submit the cancel transaction. We were not handling the error when TxCancel submission fails. - See issues: https://github.com/comit-network/xmr-btc-swap/issues/709, https://github.com/comit-network/xmr-btc-swap/issues/688, https://github.com/comit-network/xmr-btc-swap/issues/701. + We also configured the electrum client to retry 5 times in order to help with this problem. + See issues: https://github.com/comit-network/xmr-btc-swap/issues/709 https://github.com/comit-network/xmr-btc-swap/issues/688, https://github.com/comit-network/xmr-btc-swap/issues/701. ## [0.8.1] - 2021-08-16 diff --git a/swap/src/bitcoin/wallet.rs b/swap/src/bitcoin/wallet.rs index b2554e80..4bdc6388 100644 --- a/swap/src/bitcoin/wallet.rs +++ b/swap/src/bitcoin/wallet.rs @@ -48,7 +48,10 @@ impl Wallet { env_config: env::Config, target_block: usize, ) -> Result { - let client = bdk::electrum_client::Client::new(electrum_rpc_url.as_str()) + let config = bdk::electrum_client::ConfigBuilder::default() + .retry(5) + .build(); + let client = bdk::electrum_client::Client::from_config(electrum_rpc_url.as_str(), config) .context("Failed to initialize Electrum RPC client")?; let db = bdk::sled::open(wallet_dir)?.open_tree(SLED_TREE_NAME)?;