Skip to content

Commit

Permalink
Add rpc getblockcount (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Sunsi Abreu <[email protected]>
  • Loading branch information
lorenzolfm and lsunsi authored Mar 7, 2024
1 parent a2c02b3 commit 1af2f1d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Output = bitcoincore_rpc::Result<u64>> {
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,
Expand Down

0 comments on commit 1af2f1d

Please sign in to comment.