Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lwk_wollet/src/clients/electrum_client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::store::Height;
use crate::Error;
use electrum_client::ScriptStatus;
use electrum_client::{Client, ConfigBuilder, ElectrumApi, GetHistoryRes};
use electrum_client::{ScriptStatus, Socks5Config};
use elements::encode::deserialize as elements_deserialize;
use elements::encode::serialize as elements_serialize;
use elements::Address;
Expand Down Expand Up @@ -98,7 +98,13 @@ impl ElectrumUrl {
}
ElectrumUrl::Plaintext(url) => (format!("tcp://{}", url), builder),
};
let builder = builder.timeout(options.timeout);
let socks5_config = options.socks5.as_ref().map(Socks5Config::new);
let builder = builder
.retry(options.retry)
.timeout(options.timeout)
.socks5(socks5_config)
.validate_domain(options.validate_domain);

Ok(Client::from_config(&url, builder.build())?)
}
}
Expand All @@ -113,7 +119,10 @@ impl Debug for ElectrumClient {

#[derive(Default)]
pub struct ElectrumOptions {
timeout: Option<u8>,
pub timeout: Option<u8>,
pub retry: u8,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This as default would be 0, but in electrum_client::Config the default is 1 (not sure what happens with 0)

pub socks5: Option<String>,
pub validate_domain: bool,
}

impl ElectrumClient {
Expand Down
Loading