]> Untitled Git - bdk/commitdiff
electrum: add validate_domain to ElectrumBlockchainConfig
authorIgor Cota <igor@openbook.hr>
Fri, 25 Nov 2022 09:32:13 +0000 (10:32 +0100)
committerIgor Cota <igor@openbook.hr>
Tue, 20 Dec 2022 09:44:57 +0000 (10:44 +0100)
src/blockchain/any.rs
src/blockchain/electrum.rs

index 3138d02535c7ad6ea861c0c1a32ed555e5edd508..1d1a407ddfdc6531031aed8c48373368bfd76ea2 100644 (file)
@@ -178,7 +178,8 @@ impl_from!(boxed rpc::RpcBlockchain, AnyBlockchain, Rpc, #[cfg(feature = "rpc")]
 ///    "type" : "electrum",
 ///    "url" : "ssl://electrum.blockstream.info:50002",
 ///    "retry": 2,
-///    "stop_gap": 20
+///    "stop_gap": 20,
+///    "validate_domain": true
 /// }"#,
 /// )
 /// .unwrap();
@@ -190,6 +191,7 @@ impl_from!(boxed rpc::RpcBlockchain, AnyBlockchain, Rpc, #[cfg(feature = "rpc")]
 ///         socks5: None,
 ///         timeout: None,
 ///         stop_gap: 20,
+///         validate_domain: true,
 ///     })
 /// );
 /// # }
index 23c7500e405d0f1c78f0c3e3b23595b473b5fd9b..6cbeef5651fc4c83445548f2d8ef2739332be314 100644 (file)
@@ -312,6 +312,8 @@ pub struct ElectrumBlockchainConfig {
     pub timeout: Option<u8>,
     /// Stop searching addresses for transactions after finding an unused gap of this length
     pub stop_gap: usize,
+    /// Validate the domain when using SSL
+    pub validate_domain: bool,
 }
 
 impl ConfigurableBlockchain for ElectrumBlockchain {
@@ -323,6 +325,7 @@ impl ConfigurableBlockchain for ElectrumBlockchain {
             .retry(config.retry)
             .timeout(config.timeout)?
             .socks5(socks5)?
+            .validate_domain(config.validate_domain)
             .build();
 
         Ok(ElectrumBlockchain {
@@ -417,6 +420,7 @@ mod test {
                     retry: 0,
                     timeout: None,
                     stop_gap: stop_gap,
+                    validate_domain: true,
                 })
             }
         }