mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: integrate SignedTx AT into StaticFileProviderRW (#12764)
This commit is contained in:
@ -13,12 +13,14 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
# reth
|
||||
reth-codecs.workspace = true
|
||||
reth-db.workspace = true
|
||||
reth-db-api.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-storage-errors.workspace = true
|
||||
reth-tokio-util.workspace = true
|
||||
reth-prune-types.workspace = true
|
||||
reth-primitives-traits.workspace = true
|
||||
reth-static-file-types.workspace = true
|
||||
reth-stages-types.workspace = true
|
||||
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
use crate::segments::Segment;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use reth_db::tables;
|
||||
use reth_codecs::Compact;
|
||||
use reth_db::{table::Value, tables};
|
||||
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{
|
||||
providers::StaticFileWriter, BlockReader, DBProvider, StaticFileProviderFactory,
|
||||
};
|
||||
@ -13,8 +15,11 @@ use std::ops::RangeInclusive;
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Transactions;
|
||||
|
||||
impl<Provider: StaticFileProviderFactory + DBProvider + BlockReader> Segment<Provider>
|
||||
for Transactions
|
||||
impl<Provider> Segment<Provider> for Transactions
|
||||
where
|
||||
Provider: StaticFileProviderFactory<Primitives: NodePrimitives<SignedTx: Value + Compact>>
|
||||
+ DBProvider
|
||||
+ BlockReader,
|
||||
{
|
||||
fn segment(&self) -> StaticFileSegment {
|
||||
StaticFileSegment::Transactions
|
||||
@ -38,8 +43,9 @@ impl<Provider: StaticFileProviderFactory + DBProvider + BlockReader> Segment<Pro
|
||||
.block_body_indices(block)?
|
||||
.ok_or(ProviderError::BlockBodyIndicesNotFound(block))?;
|
||||
|
||||
let mut transactions_cursor =
|
||||
provider.tx_ref().cursor_read::<tables::Transactions>()?;
|
||||
let mut transactions_cursor = provider.tx_ref().cursor_read::<tables::Transactions<
|
||||
<<Provider as StaticFileProviderFactory>::Primitives as NodePrimitives>::SignedTx,
|
||||
>>()?;
|
||||
let transactions_walker =
|
||||
transactions_cursor.walk_range(block_body_indices.tx_num_range())?;
|
||||
|
||||
|
||||
@ -4,6 +4,9 @@ use crate::{segments, segments::Segment, StaticFileProducerEvent};
|
||||
use alloy_primitives::BlockNumber;
|
||||
use parking_lot::Mutex;
|
||||
use rayon::prelude::*;
|
||||
use reth_codecs::Compact;
|
||||
use reth_db::table::Value;
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::{
|
||||
providers::StaticFileWriter, BlockReader, ChainStateBlockReader, DBProvider,
|
||||
DatabaseProviderFactory, StageCheckpointReader, StaticFileProviderFactory,
|
||||
@ -86,7 +89,10 @@ impl<Provider> StaticFileProducerInner<Provider>
|
||||
where
|
||||
Provider: StaticFileProviderFactory
|
||||
+ DatabaseProviderFactory<
|
||||
Provider: StaticFileProviderFactory + StageCheckpointReader + BlockReader,
|
||||
Provider: StaticFileProviderFactory<
|
||||
Primitives: NodePrimitives<SignedTx: Value + Compact>,
|
||||
> + StageCheckpointReader
|
||||
+ BlockReader,
|
||||
>,
|
||||
{
|
||||
/// Listen for events on the `static_file_producer`.
|
||||
|
||||
Reference in New Issue
Block a user