feat(sync): add tx hash number mapping (#417)

This commit is contained in:
Roman Krasiuk
2022-12-13 19:53:16 +02:00
committed by GitHub
parent d7f3581e51
commit 2ace52a8dd
3 changed files with 36 additions and 9 deletions

View File

@ -18,7 +18,7 @@ use crate::{
};
use reth_primitives::{
Account, Address, BlockHash, BlockNumber, Header, IntegerList, Receipt, StorageEntry,
TransactionSigned, TxNumber, H256,
TransactionSigned, TxHash, TxNumber, H256,
};
/// Enum for the types of tables present in libmdbx.
@ -31,7 +31,7 @@ pub enum TableType {
}
/// Default tables that should be present inside database.
pub const TABLES: [(TableType, &str); 20] = [
pub const TABLES: [(TableType, &str); 21] = [
(TableType::Table, CanonicalHeaders::const_name()),
(TableType::Table, HeaderTD::const_name()),
(TableType::Table, HeaderNumbers::const_name()),
@ -40,6 +40,7 @@ pub const TABLES: [(TableType, &str); 20] = [
(TableType::Table, CumulativeTxCount::const_name()),
(TableType::Table, NonCanonicalTransactions::const_name()),
(TableType::Table, Transactions::const_name()),
(TableType::Table, TxHashNumber::const_name()),
(TableType::Table, Receipts::const_name()),
(TableType::Table, Logs::const_name()),
(TableType::Table, PlainAccountState::const_name()),
@ -145,6 +146,11 @@ table!(
( Transactions ) TxNumber | TransactionSigned
);
table!(
/// Stores the mapping of the transaction hash to the transaction number.
( TxHashNumber ) TxHash | TxNumber
);
table!(
/// (Canonical only) Stores transaction receipts.
( Receipts ) TxNumber | Receipt