mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-27 16:18:08 -05:00
fix: encode block as is in debug_getRawBlock (#9353)
This commit is contained in:
@@ -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()));
|
||||
|
||||
@@ -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,
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user