From 9599e3b16f123e16b1d508af4bd2890e94263639 Mon Sep 17 00:00:00 2001 From: Lucas Sunsi Abreu Date: Fri, 9 Feb 2024 11:00:10 -0300 Subject: [PATCH] Add rpc getblockcount --- src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d8f30a0..1931043 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,6 +23,17 @@ pub fn build(rpc_user: &str, rpc_password: &str, rpc_url: &str) -> bitcoincore_r } impl Btc { + pub fn get_block_count(&self) -> impl Future> { + let client = self.client.clone(); + + async move { + tokio::task::spawn_blocking(move || client.get_block_count()) + .await + .unwrap() + } + .instrument(span!("get_block_count")) + } + pub fn list_transactions( &self, count: usize,