Skip to content

Commit

Permalink
Extend check to earliest
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard committed Nov 13, 2023
1 parent b201f0a commit 6afaaea
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions client/rpc/src/eth/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use sc_transaction_pool_api::InPoolTransaction;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_core::hashing::keccak_256;
use sp_runtime::traits::Block as BlockT;
use sp_runtime::traits::{Zero, Block as BlockT};
// Frontier
use fc_rpc_core::types::*;
use fp_rpc::EthereumRuntimeRPCApi;
Expand Down Expand Up @@ -157,7 +157,15 @@ where
}
_ => {
log::info!(">>>> Matched in _");
if let BlockNumber::Num(block_number) = number {
let maybe_block_number = if let BlockNumber::Num(block_number) = number {
Some(block_number)
} else if let BlockNumber::Earliest = number {
Some(Zero::zero())
} else {
None
};

if let Some(block_number) = maybe_block_number {
log::info!(">>>> Inner block number: {:?}", block_number);
let eth_block = empty_block_from(block_number.into());
let eth_hash = H256::from_slice(
Expand All @@ -172,7 +180,7 @@ where
false,
)))
} else {
log::info!(">>>> Returning None but this should not happen");
log::info!(">>>> Returning None but this should not");
Ok(None)
}
}
Expand Down

0 comments on commit 6afaaea

Please sign in to comment.