mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-02-26 09:31:18 -05: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 backoff::{backoff::Constant as ConstantBackoff, tokio::retry};
|
||||||
use bdk::{
|
use bdk::{
|
||||||
blockchain::{noop_progress, Blockchain, ElectrumBlockchain},
|
blockchain::{noop_progress, Blockchain, ElectrumBlockchain},
|
||||||
electrum_client::{Client, ElectrumApi},
|
electrum_client::{self, Client, ElectrumApi},
|
||||||
keys::GeneratableDefaultOptions,
|
keys::GeneratableDefaultOptions,
|
||||||
FeeRate,
|
FeeRate,
|
||||||
};
|
};
|
||||||
@ -45,7 +45,10 @@ impl Wallet {
|
|||||||
network: bitcoin::Network,
|
network: bitcoin::Network,
|
||||||
waller_dir: &Path,
|
waller_dir: &Path,
|
||||||
) -> Result<Self> {
|
) -> 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))?;
|
.map_err(|e| anyhow!("Failed to init electrum rpc client: {:?}", e))?;
|
||||||
|
|
||||||
let db = bdk::sled::open(waller_dir)?.open_tree(SLED_TREE_NAME)?;
|
let db = bdk::sled::open(waller_dir)?.open_tree(SLED_TREE_NAME)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user