diff --git a/core/api/src/jsonrpc/web3_types.rs b/core/api/src/jsonrpc/web3_types.rs index 3010b6f36..76b1c1ca5 100644 --- a/core/api/src/jsonrpc/web3_types.rs +++ b/core/api/src/jsonrpc/web3_types.rs @@ -300,7 +300,7 @@ pub struct Web3Block { pub number: U256, pub gas_used: U256, pub gas_limit: U256, - pub extra_data: Vec, + pub extra_data: Hex, pub logs_bloom: Option, pub timestamp: U256, pub difficulty: U256, @@ -331,12 +331,7 @@ impl From for Web3Block { total_difficulty: Some(b.header.number.into()), seal_fields: vec![], base_fee_per_gas: b.header.base_fee_per_gas, - extra_data: b - .header - .extra_data - .iter() - .map(|i| Hex::encode(&i.inner.encode().unwrap())) - .collect(), + extra_data: Hex::encode(rlp::encode_list(&b.header.extra_data)), size: Some(b.header.size().into()), gas_limit: b.header.gas_limit, gas_used: b.header.gas_used, @@ -826,7 +821,7 @@ pub struct FeeHistoryEmpty { #[serde(rename_all = "camelCase")] pub struct Web3Header { pub difficulty: U256, - pub extra_data: Vec, + pub extra_data: Hex, pub gas_limit: U256, pub gas_used: U256, pub logs_bloom: Option, @@ -854,11 +849,7 @@ impl From
for Web3Header { receipts_root: h.receipts_root, miner: h.proposer, difficulty: U256::one(), - extra_data: h - .extra_data - .into_iter() - .map(|i| Hex::encode(i.inner.encode().unwrap())) - .collect(), + extra_data: Hex::encode(rlp::encode_list(&h.extra_data)), gas_limit: h.gas_limit, gas_used: h.gas_used, timestamp: h.timestamp.into(),