From: Alekos Filini Date: Mon, 8 Aug 2022 10:03:35 +0000 (+0200) Subject: Implement `Deref` for `ElectrumBlockchain` X-Git-Tag: 0.22.0-rc.1~9^2 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.CodeLengthError.html?a=commitdiff_plain;h=c5952dd09a61b1cd2185c273e0b8bcb3fd6ed2dd;p=bdk Implement `Deref` for `ElectrumBlockchain` As pointed out in https://github.com/bitcoindevkit/rust-electrum-client/pull/58#issuecomment-1207890096 there was no way to keep using the client once it was given to BDK. --- diff --git a/src/blockchain/electrum.rs b/src/blockchain/electrum.rs index c1e1c66c..fdb10b47 100644 --- a/src/blockchain/electrum.rs +++ b/src/blockchain/electrum.rs @@ -25,6 +25,7 @@ //! ``` use std::collections::{HashMap, HashSet}; +use std::ops::Deref; #[allow(unused_imports)] use log::{debug, error, info, trace}; @@ -79,6 +80,14 @@ impl Blockchain for ElectrumBlockchain { } } +impl Deref for ElectrumBlockchain { + type Target = Client; + + fn deref(&self) -> &Self::Target { + &self.client + } +} + impl StatelessBlockchain for ElectrumBlockchain {} impl GetHeight for ElectrumBlockchain {