Files
nanoreth/crates/storage/provider/src/traits/state.rs
2024-05-28 13:25:31 +00:00

20 lines
781 B
Rust

use crate::providers::StaticFileProviderRWRefMut;
use reth_db::transaction::{DbTx, DbTxMut};
use reth_storage_errors::provider::ProviderResult;
use revm::db::OriginalValuesKnown;
/// A helper trait for [BundleStateWithReceipts](reth_execution_types::BundleStateWithReceipts) to
/// write state and receipts to storage.
pub trait StateWriter {
/// Write the data and receipts to the database or static files if `static_file_producer` is
/// `Some`. It should be `None` if there is any kind of pruning/filtering over the receipts.
fn write_to_storage<TX>(
self,
tx: &TX,
static_file_producer: Option<StaticFileProviderRWRefMut<'_>>,
is_value_known: OriginalValuesKnown,
) -> ProviderResult<()>
where
TX: DbTxMut + DbTx;
}