Files
reth/crates/primitives/src/block.rs
rakita ae5935e6b2 feat: reth binary and parsing of eth chain tests (#38)
* Scaffolding for reth test binary. wip for blockchain tests

* wip models for chain json tests

* reth binary and chain test

* fmt,clippy

* Update bin/reth/src/lib.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update bin/reth/src/lib.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update bin/reth/src/test_eth_chain/mod.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update bin/reth/src/test_eth_chain/mod.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update bin/reth/src/test_eth_chain/mod.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update bin/reth/src/test_eth_chain/models.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update bin/reth/src/test_eth_chain/models.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update bin/reth/src/test_eth_chain/mod.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Update bin/reth/src/test_eth_chain/runner.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* Move JsonU256 to primitives

* fmt

* Use eyre

* nits

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
2022-10-12 17:43:01 +02:00

46 lines
1.0 KiB
Rust

use crate::{Header, HeaderLocked, Receipt, Transaction, TransactionSigned, H256};
use std::ops::Deref;
/// Ethereum full block.
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct Block {
/// Block header.
pub header: Header,
/// Transactions in this block.
pub body: Vec<Transaction>,
/// Block receipts.
pub receipts: Vec<Receipt>,
}
impl Deref for Block {
type Target = Header;
fn deref(&self) -> &Self::Target {
&self.header
}
}
/// Sealed Ethereum full block.
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct BlockLocked {
/// Locked block header.
pub header: HeaderLocked,
/// Transactions with signatures.
pub body: Vec<TransactionSigned>,
/// Block receipts.
pub receipts: Vec<Receipt>,
}
impl BlockLocked {
/// Header hash.
pub fn hash(&self) -> H256 {
self.header.hash()
}
}
impl Deref for BlockLocked {
type Target = Header;
fn deref(&self) -> &Self::Target {
self.header.as_ref()
}
}