Skip to content

Commit

Permalink
chore: add blockbody default
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Oct 24, 2024
1 parent b621af0 commit 84a4b23
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/consensus/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Block<T> {
/// A response to `GetBlockBodies`, containing bodies if any bodies were found.
///
/// Withdrawals can be optionally included at the end of the RLP encoded message.
#[derive(Debug, Clone, PartialEq, Eq, Default, RlpEncodable, RlpDecodable)]
#[derive(Debug, Clone, PartialEq, Eq, RlpEncodable, RlpDecodable)]
#[rlp(trailing)]
pub struct BlockBody<T> {
/// Transactions in this block.
Expand All @@ -34,6 +34,12 @@ pub struct BlockBody<T> {
pub withdrawals: Option<Withdrawals>,
}

impl<T> Default for BlockBody<T> {
fn default() -> Self {
Self { transactions: Vec::new(), ommers: Vec::new(), withdrawals: None }
}
}

/// We need to implement RLP traits manually because we currently don't have a way to flatten
/// [`BlockBody`] into [`Block`].
mod block_rlp {
Expand Down

0 comments on commit 84a4b23

Please sign in to comment.