From bf7c435dce5dd1f6df91b82edc8ae4b3a82f9952 Mon Sep 17 00:00:00 2001 From: i5hi Date: Fri, 20 Sep 2024 18:13:17 +0530 Subject: [PATCH] Updated electrum config to support socks5 & validate_domain --- lwk_wollet/src/clients/electrum_client.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lwk_wollet/src/clients/electrum_client.rs b/lwk_wollet/src/clients/electrum_client.rs index 31665e5a..2be32111 100644 --- a/lwk_wollet/src/clients/electrum_client.rs +++ b/lwk_wollet/src/clients/electrum_client.rs @@ -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; @@ -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 + .timeout(options.timeout) + .socks5(socks5_config) + .validate_domain(options.validate_domain); + Ok(Client::from_config(&url, builder.build())?) } } @@ -113,7 +119,9 @@ impl Debug for ElectrumClient { #[derive(Default)] pub struct ElectrumOptions { - timeout: Option, + pub timeout: Option, + pub socks5: Option, + pub validate_domain: bool, } impl ElectrumClient {