diff --git a/src/client/rpc_api.rs b/src/client/rpc_api.rs index 3b8024b..1838431 100644 --- a/src/client/rpc_api.rs +++ b/src/client/rpc_api.rs @@ -631,7 +631,10 @@ impl RpcApi for Client { #[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()) + Ok(self + .ledger + .get_block_with_height(height as u32)? + .block_hash()) } } diff --git a/src/ledger/block.rs b/src/ledger/block.rs index 19eea9e..56411c5 100644 --- a/src/ledger/block.rs +++ b/src/ledger/block.rs @@ -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), @@ -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>(0).unwrap()) - }, + |row| Ok(row.get::<_, Vec>(0).unwrap()), ) { Ok(qr) => qr, Err(e) => {