feat: add Transaction AT to TransactionsProvider (#12794)

This commit is contained in:
Arsenii Kulikov
2024-11-23 03:04:42 +04:00
committed by GitHub
parent 36db1c2407
commit 5db3ad1a67
33 changed files with 389 additions and 271 deletions

View File

@ -39,6 +39,7 @@ reth-trie-db = { workspace = true, features = ["metrics"] }
reth-testing-utils = { workspace = true, optional = true }
alloy-eips.workspace = true
alloy-primitives.workspace = true
alloy-consensus.workspace = true

View File

@ -1,12 +1,15 @@
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{TxHash, TxNumber};
use num_traits::Zero;
use reth_config::config::{EtlConfig, TransactionLookupConfig};
use reth_db::{tables, RawKey, RawValue};
use reth_db::{table::Value, tables, RawKey, RawValue};
use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW},
transaction::{DbTx, DbTxMut},
};
use reth_etl::Collector;
use reth_primitives::NodePrimitives;
use reth_primitives_traits::SignedTransaction;
use reth_provider::{
BlockReader, DBProvider, PruneCheckpointReader, PruneCheckpointWriter,
StaticFileProviderFactory, StatsReader, TransactionsProvider, TransactionsProviderExt,
@ -60,7 +63,7 @@ where
+ BlockReader
+ PruneCheckpointReader
+ StatsReader
+ StaticFileProviderFactory
+ StaticFileProviderFactory<Primitives: NodePrimitives<SignedTx: Value + SignedTransaction>>
+ TransactionsProviderExt,
{
/// Return the id of the stage
@ -206,7 +209,7 @@ where
for tx_id in body.tx_num_range() {
// First delete the transaction and hash to id mapping
if let Some(transaction) = static_file_provider.transaction_by_id(tx_id)? {
if tx_hash_number_cursor.seek_exact(transaction.hash())?.is_some() {
if tx_hash_number_cursor.seek_exact(transaction.trie_hash())?.is_some() {
tx_hash_number_cursor.delete_current()?;
}
}