mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 09:08:05 -05:00
fix: change append with put. Some nit comments (#1070)
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::{
|
||||
db::Transaction, ExecInput, ExecOutput, Stage, StageError, StageId, UnwindInput, UnwindOutput,
|
||||
};
|
||||
use reth_db::{
|
||||
cursor::{DbCursorRO, DbCursorRW},
|
||||
cursor::DbCursorRO,
|
||||
database::Database,
|
||||
tables,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
@@ -76,9 +76,10 @@ impl<DB: Database> Stage<DB> for AccountHashingStage {
|
||||
// next key of iterator
|
||||
let next_key = accounts.next()?;
|
||||
|
||||
let mut hashes = tx.cursor_write::<tables::HashedAccount>()?;
|
||||
// iterate and append presorted hashed accounts
|
||||
hashed_batch.into_iter().try_for_each(|(k, v)| hashes.append(k, v))?;
|
||||
// iterate and put presorted hashed accounts
|
||||
hashed_batch
|
||||
.into_iter()
|
||||
.try_for_each(|(k, v)| tx.put::<tables::HashedAccount>(k, v))?;
|
||||
next_key
|
||||
};
|
||||
tx.commit()?;
|
||||
|
||||
@@ -80,9 +80,10 @@ impl<DB: Database> Stage<DB> for StorageHashingStage {
|
||||
// next key of iterator
|
||||
let next_key = storage.next()?;
|
||||
|
||||
let mut hashes = tx.cursor_write::<tables::HashedStorage>()?;
|
||||
// iterate and append presorted hashed slots
|
||||
hashed_batch.into_iter().try_for_each(|(k, v)| hashes.append(k, v))?;
|
||||
// iterate and put presorted hashed slots
|
||||
hashed_batch
|
||||
.into_iter()
|
||||
.try_for_each(|(k, v)| tx.put::<tables::HashedStorage>(k, v))?;
|
||||
next_key
|
||||
};
|
||||
tx.commit()?;
|
||||
|
||||
@@ -16,8 +16,8 @@ use tracing::*;
|
||||
|
||||
const INDEX_ACCOUNT_HISTORY: StageId = StageId("IndexAccountHistoryStage");
|
||||
|
||||
/// Account hashing stage hashes plain account.
|
||||
/// This is preparation before generating intermediate hashes and calculating Merkle tree root.
|
||||
/// Stage is indexing history the account changesets generated in [`ExecutionStage`]
|
||||
/// For more information on index sharding please look at [`tables::AccountHistory`]
|
||||
#[derive(Debug)]
|
||||
pub struct IndexAccountHistoryStage {
|
||||
/// Number of blocks after which the control
|
||||
|
||||
@@ -16,8 +16,8 @@ use tracing::*;
|
||||
|
||||
const INDEX_STORAGE_HISTORY: StageId = StageId("IndexStorageHistoryStage");
|
||||
|
||||
/// Account hashing stage hashes plain account.
|
||||
/// This is preparation before generating intermediate hashes and calculating Merkle tree root.
|
||||
/// Stage is indexing history the account changesets generated in [`ExecutionStage`]
|
||||
/// For more information on index sharding please look at [`tables::StorageHistory`]
|
||||
#[derive(Debug)]
|
||||
pub struct IndexStorageHistoryStage {
|
||||
/// Number of blocks after which the control
|
||||
|
||||
Reference in New Issue
Block a user