Skip to content

Commit

Permalink
Fmt and lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Nov 7, 2024
1 parent 3dca4f6 commit c16c241
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/client/rpc_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,10 @@ impl RpcApi for Client {

#[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())
Ok(self
.ledger
.get_block_with_height(height as u32)?
.block_hash())
}
}

Expand Down
9 changes: 2 additions & 7 deletions src/ledger/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ impl Ledger {
}
};
// Genesis block will also return a database error. Ignore that.
let body = match body {
Ok(b) => b,
Err(_) => Vec::new(),
};
let body = body.unwrap_or_default();

match Block::consensus_decode(&mut body.as_slice()) {
Ok(block) => Ok(block),
Expand Down Expand Up @@ -181,9 +178,7 @@ impl Ledger {
let qr = match self.database.lock().unwrap().query_row(
"SELECT body FROM blocks WHERE hash = ?1",
params![encoded_hash],
|row| {
Ok(row.get::<_, Vec<u8>>(0).unwrap())
},
|row| Ok(row.get::<_, Vec<u8>>(0).unwrap()),
) {
Ok(qr) => qr,
Err(e) => {
Expand Down

0 comments on commit c16c241

Please sign in to comment.