From 3dca4f61fdfcfc217a70da4c7e727f6f9e1eb854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Thu, 7 Nov 2024 11:40:35 +0700 Subject: [PATCH] block: Add get_block_hash. --- src/client/rpc_api.rs | 5 +++++ src/ledger/block.rs | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/rpc_api.rs b/src/client/rpc_api.rs index 2984216..3b8024b 100644 --- a/src/client/rpc_api.rs +++ b/src/client/rpc_api.rs @@ -628,6 +628,11 @@ impl RpcApi for Client { Ok(vec![tip]) } + + #[tracing::instrument(skip_all)] + fn get_block_hash(&self, height: u64) -> bitcoincore_rpc::Result { + Ok(self.ledger.get_block_with_height(height as u32)?.block_hash()) + } } #[cfg(test)] diff --git a/src/ledger/block.rs b/src/ledger/block.rs index 6017ff9..19eea9e 100644 --- a/src/ledger/block.rs +++ b/src/ledger/block.rs @@ -182,7 +182,6 @@ impl Ledger { "SELECT body FROM blocks WHERE hash = ?1", params![encoded_hash], |row| { - tracing::error!("row {:?}", row); Ok(row.get::<_, Vec>(0).unwrap()) }, ) {