Configure electrum client to retry 5 times

This commit is contained in:
rishflab 2021-08-30 14:43:53 +10:00
parent 18faa786d6
commit 8598bcade1
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -48,7 +48,10 @@ impl Wallet {
env_config: env::Config,
target_block: usize,
) -> Result<Self> {
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)?;