Skip to content

Commit cc6be97

Browse files
committed
Updated electrum config to support socks5, retry & validate_domain
1 parent 7c2b74c commit cc6be97

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lwk_wollet/src/clients/electrum_client.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::store::Height;
22
use crate::Error;
3-
use electrum_client::ScriptStatus;
43
use electrum_client::{Client, ConfigBuilder, ElectrumApi, GetHistoryRes};
4+
use electrum_client::{ScriptStatus, Socks5Config};
55
use elements::encode::deserialize as elements_deserialize;
66
use elements::encode::serialize as elements_serialize;
77
use elements::Address;
@@ -98,7 +98,13 @@ impl ElectrumUrl {
9898
}
9999
ElectrumUrl::Plaintext(url) => (format!("tcp://{}", url), builder),
100100
};
101-
let builder = builder.timeout(options.timeout);
101+
let socks5_config = options.socks5.as_ref().map(Socks5Config::new);
102+
let builder = builder
103+
.retry(options.retry)
104+
.timeout(options.timeout)
105+
.socks5(socks5_config)
106+
.validate_domain(options.validate_domain);
107+
102108
Ok(Client::from_config(&url, builder.build())?)
103109
}
104110
}
@@ -113,7 +119,10 @@ impl Debug for ElectrumClient {
113119

114120
#[derive(Default)]
115121
pub struct ElectrumOptions {
116-
timeout: Option<u8>,
122+
pub timeout: Option<u8>,
123+
pub retry: u8,
124+
pub socks5: Option<String>,
125+
pub validate_domain: bool,
117126
}
118127

119128
impl ElectrumClient {

0 commit comments

Comments
 (0)