mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Instantiate electrum client with custom config with 2 retries
The default number of retries is 1. Unfortunately, the way this config value is interpreted doesn't actually lead to a retry. We have to set it to 2 to actually make it retry. See https://github.com/bitcoindevkit/rust-electrum-client/issues/47.
This commit is contained in:
parent
180e778df9
commit
a51194b9fa
@ -12,7 +12,7 @@ use async_trait::async_trait;
|
||||
use backoff::{backoff::Constant as ConstantBackoff, tokio::retry};
|
||||
use bdk::{
|
||||
blockchain::{noop_progress, Blockchain, ElectrumBlockchain},
|
||||
electrum_client::{Client, ElectrumApi},
|
||||
electrum_client::{self, Client, ElectrumApi},
|
||||
keys::GeneratableDefaultOptions,
|
||||
FeeRate,
|
||||
};
|
||||
@ -45,7 +45,10 @@ impl Wallet {
|
||||
network: bitcoin::Network,
|
||||
waller_dir: &Path,
|
||||
) -> Result<Self> {
|
||||
let client = Client::new(electrum_rpc_url.as_str())
|
||||
// Workaround for https://github.com/bitcoindevkit/rust-electrum-client/issues/47.
|
||||
let config = electrum_client::ConfigBuilder::default().retry(2).build();
|
||||
|
||||
let client = Client::from_config(electrum_rpc_url.as_str(), config)
|
||||
.map_err(|e| anyhow!("Failed to init electrum rpc client: {:?}", e))?;
|
||||
|
||||
let db = bdk::sled::open(waller_dir)?.open_tree(SLED_TREE_NAME)?;
|
||||
|
Loading…
Reference in New Issue
Block a user