From c5952dd09a61b1cd2185c273e0b8bcb3fd6ed2dd Mon Sep 17 00:00:00 2001 From: Alekos Filini Date: Mon, 8 Aug 2022 12:03:35 +0200 Subject: [PATCH] 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. --- src/blockchain/electrum.rs | 9 +++++++++ 1 file changed, 9 insertions(+) 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 {