From f50f196601de97d1bb3adebd056d09340d0cf161 Mon Sep 17 00:00:00 2001 From: David Craven Date: Thu, 17 Aug 2023 17:06:28 +0200 Subject: [PATCH] Fix tests. --- chains/ethereum/server/src/lib.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/chains/ethereum/server/src/lib.rs b/chains/ethereum/server/src/lib.rs index 3deb6b92..70943fe7 100644 --- a/chains/ethereum/server/src/lib.rs +++ b/chains/ethereum/server/src/lib.rs @@ -80,15 +80,18 @@ impl BlockchainClient for EthereumClient { } async fn finalized_block(&self) -> Result { - let block = self + if let Some(block) = self .client .get_block(BlockId::Number(BlockNumber::Finalized)) .await? - .context("missing block")?; - Ok(BlockIdentifier { - index: block.number.context("Block is pending")?.as_u64(), - hash: hex::encode(block.hash.as_ref().unwrap()), - }) + { + Ok(BlockIdentifier { + index: block.number.context("Block is pending")?.as_u64(), + hash: hex::encode(block.hash.as_ref().unwrap()), + }) + } else { + Ok(self.genesis_block.clone()) + } } async fn balance(&self, address: &Address, block: &BlockIdentifier) -> Result {