Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/rpc/rpc-builder/tests/it/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ where
let block_id = BlockId::Number(BlockNumberOrTag::default());

DebugApiClient::raw_header(client, block_id).await.unwrap();
DebugApiClient::raw_block(client, block_id).await.unwrap();
DebugApiClient::raw_block(client, block_id).await.unwrap_err();
DebugApiClient::raw_transaction(client, B256::default()).await.unwrap();
DebugApiClient::raw_receipts(client, block_id).await.unwrap();
assert!(is_unimplemented(DebugApiClient::bad_blocks(client).await.err().unwrap()));
Expand Down
20 changes: 8 additions & 12 deletions crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use jsonrpsee::core::RpcResult;
use reth_chainspec::EthereumHardforks;
use reth_evm::ConfigureEvmEnv;
use reth_primitives::{
Address, Block, BlockId, BlockNumberOrTag, Bytes, TransactionSignedEcRecovered, Withdrawals,
B256, U256,
Address, Block, BlockId, BlockNumberOrTag, Bytes, TransactionSignedEcRecovered, B256, U256,
};
use reth_provider::{
BlockReaderIdExt, ChainSpecProvider, EvmEnvProvider, HeaderProvider, StateProviderFactory,
Expand Down Expand Up @@ -674,17 +673,14 @@ where

/// Handler for `debug_getRawBlock`
async fn raw_block(&self, block_id: BlockId) -> RpcResult<Bytes> {
let block = self.inner.provider.block_by_id(block_id).to_rpc_result()?;

let block = self
.inner
.provider
.block_by_id(block_id)
.to_rpc_result()?
.ok_or_else(|| EthApiError::UnknownBlockNumber)?;
let mut res = Vec::new();
if let Some(mut block) = block {
// In RPC withdrawals are always present
if block.withdrawals.is_none() {
block.withdrawals = Some(Withdrawals::default());
}
block.encode(&mut res);
}

block.encode(&mut res);
Ok(res.into())
}

Expand Down