Skip to content

Commit

Permalink
block: Add get_block_hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Nov 7, 2024
1 parent 1c82ab0 commit 3dca4f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/client/rpc_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bitcoin::BlockHash> {
Ok(self.ledger.get_block_with_height(height as u32)?.block_hash())
}
}

#[cfg(test)]
Expand Down
1 change: 0 additions & 1 deletion src/ledger/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>>(0).unwrap())
},
) {
Expand Down

0 comments on commit 3dca4f6

Please sign in to comment.