Skip to content

Commit

Permalink
Derive default implementation for rpc Block (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Apr 5, 2024
1 parent 05711f1 commit 8be4ac8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/rpc-types/src/eth/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use serde::{
use std::{collections::BTreeMap, fmt, num::ParseIntError, ops::Deref, str::FromStr};

/// Block representation
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
#[derive(Default, Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Block {
/// Header of the block.
Expand Down Expand Up @@ -52,7 +52,7 @@ impl Block {

/// Block header representation.
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
#[serde(rename_all = "camelCase")]
pub struct Header {
/// Hash of the block
Expand Down Expand Up @@ -158,6 +158,12 @@ pub enum BlockTransactions<T = Transaction> {
Uncle,
}

impl Default for BlockTransactions {
fn default() -> Self {
BlockTransactions::Hashes(Vec::default())
}
}

impl BlockTransactions {
/// Converts `self` into `Hashes`.
#[inline]
Expand Down

0 comments on commit 8be4ac8

Please sign in to comment.