mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: withdrawals (#1322)
Co-authored-by: rakita <rakita@users.noreply.github.com>
This commit is contained in:
@ -42,7 +42,8 @@ impl_compression_for_compact!(
|
||||
StorageEntry,
|
||||
StorageTrieEntry,
|
||||
StoredBlockBody,
|
||||
StoredBlockOmmers
|
||||
StoredBlockOmmers,
|
||||
StoredBlockWithdrawals
|
||||
);
|
||||
impl_compression_for_compact!(AccountBeforeTx, TransactionSigned);
|
||||
impl_compression_for_compact!(CompactU256);
|
||||
|
||||
@ -12,7 +12,8 @@ use crate::{
|
||||
models::{
|
||||
accounts::{AccountBeforeTx, TransitionIdAddress},
|
||||
blocks::{HeaderHash, StoredBlockOmmers},
|
||||
ShardedKey,
|
||||
storage_sharded_key::StorageShardedKey,
|
||||
ShardedKey, StoredBlockBody, StoredBlockWithdrawals,
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -21,8 +22,6 @@ use reth_primitives::{
|
||||
StorageTrieEntry, TransactionSigned, TransitionId, TxHash, TxNumber, H256,
|
||||
};
|
||||
|
||||
use self::models::{storage_sharded_key::StorageShardedKey, StoredBlockBody};
|
||||
|
||||
/// Enum for the types of tables present in libmdbx.
|
||||
#[derive(Debug)]
|
||||
pub enum TableType {
|
||||
@ -33,13 +32,14 @@ pub enum TableType {
|
||||
}
|
||||
|
||||
/// Default tables that should be present inside database.
|
||||
pub const TABLES: [(TableType, &str); 26] = [
|
||||
pub const TABLES: [(TableType, &str); 27] = [
|
||||
(TableType::Table, CanonicalHeaders::const_name()),
|
||||
(TableType::Table, HeaderTD::const_name()),
|
||||
(TableType::Table, HeaderNumbers::const_name()),
|
||||
(TableType::Table, Headers::const_name()),
|
||||
(TableType::Table, BlockBodies::const_name()),
|
||||
(TableType::Table, BlockOmmers::const_name()),
|
||||
(TableType::Table, BlockWithdrawals::const_name()),
|
||||
(TableType::Table, Transactions::const_name()),
|
||||
(TableType::Table, TxHashNumber::const_name()),
|
||||
(TableType::Table, Receipts::const_name()),
|
||||
@ -141,6 +141,11 @@ table!(
|
||||
( BlockOmmers ) BlockNumber | StoredBlockOmmers
|
||||
);
|
||||
|
||||
table!(
|
||||
/// Stores the block withdrawals.
|
||||
( BlockWithdrawals ) BlockNumber | StoredBlockWithdrawals
|
||||
);
|
||||
|
||||
table!(
|
||||
/// (Canonical only) Stores the transaction body for canonical transactions.
|
||||
( Transactions ) TxNumber | TransactionSigned
|
||||
|
||||
@ -9,7 +9,7 @@ use crate::{
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use reth_codecs::{main_codec, Compact};
|
||||
use reth_primitives::{BlockHash, BlockNumber, Header, TxNumber, H256};
|
||||
use reth_primitives::{BlockHash, BlockNumber, Header, TxNumber, Withdrawal, H256};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Total number of transactions.
|
||||
@ -51,13 +51,21 @@ impl StoredBlockBody {
|
||||
///
|
||||
/// It is stored as the headers of the block's uncles.
|
||||
/// tx_amount)`.
|
||||
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
||||
#[main_codec]
|
||||
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
||||
pub struct StoredBlockOmmers {
|
||||
/// The block headers of this block's uncles.
|
||||
pub ommers: Vec<Header>,
|
||||
}
|
||||
|
||||
/// The storage representation of block withdrawals.
|
||||
#[main_codec]
|
||||
#[derive(Debug, Default, Eq, PartialEq, Clone)]
|
||||
pub struct StoredBlockWithdrawals {
|
||||
/// The block withdrawals.
|
||||
pub withdrawals: Vec<Withdrawal>,
|
||||
}
|
||||
|
||||
/// Hash of the block header. Value for [`CanonicalHeaders`][crate::tables::CanonicalHeaders]
|
||||
pub type HeaderHash = H256;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user