mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 17:18:08 -05:00
fix(rpc): always include withdrawals in RPC (#1894)
This commit is contained in:
@@ -747,6 +747,17 @@ mod test {
|
||||
assert_eq!(parsed, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn encode_decode_raw_block() {
|
||||
let block = "0xf90288f90218a0fe21bb173f43067a9f90cfc59bbb6830a7a2929b5de4a61f372a9db28e87f9aea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a061effbbcca94f0d3e02e5bd22e986ad57142acabf0cb3d129a6ad8d0f8752e94a0d911c25e97e27898680d242b7780b6faef30995c355a2d5de92e6b9a7212ad3aa0056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008003834c4b408252081e80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000842806be9da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421f869f86702842806be9e82520894658bdf435d810c91414ec09147daa6db624063798203e880820a95a040ce7918eeb045ebf8c8b1887ca139d076bda00fa828a07881d442a72626c42da0156576a68e456e295e4c9cf67cf9f53151f329438916e0f24fc69d6bbb7fbacfc0c0";
|
||||
let bytes = hex::decode(&block[2..]).unwrap();
|
||||
let bytes_buf = &mut bytes.as_ref();
|
||||
let block = Block::decode(bytes_buf).unwrap();
|
||||
let mut encoded_buf = Vec::new();
|
||||
block.encode(&mut encoded_buf);
|
||||
assert_eq!(bytes, encoded_buf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serde_blocknumber_non_0xprefix() {
|
||||
let s = "\"2\"";
|
||||
|
||||
@@ -155,7 +155,11 @@ where
|
||||
let block = self.client.block(block_id).to_rpc_result()?;
|
||||
|
||||
let mut res = Vec::new();
|
||||
if let Some(block) = block {
|
||||
if let Some(mut block) = block {
|
||||
// In RPC withdrawals are always present
|
||||
if block.withdrawals.is_none() {
|
||||
block.withdrawals = Some(vec![]);
|
||||
}
|
||||
block.encode(&mut res);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user