mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix(stages): unwind receipts in execution stage (#2900)
This commit is contained in:
@ -573,6 +573,7 @@ impl PostState {
|
||||
self.write_history_to_db(tx)?;
|
||||
|
||||
// Write new storage state
|
||||
tracing::trace!(target: "provider::post_state", len = self.storage.len(), "Writing new storage state");
|
||||
let mut storages_cursor = tx.cursor_dup_write::<tables::PlainStorageState>()?;
|
||||
for (address, storage) in self.storage.into_iter() {
|
||||
// If the storage was wiped at least once, remove all previous entries from the
|
||||
@ -613,13 +614,14 @@ impl PostState {
|
||||
}
|
||||
|
||||
// Write bytecode
|
||||
tracing::trace!(target: "provider::post_state", len = self.bytecode.len(), "Writing bytecods");
|
||||
tracing::trace!(target: "provider::post_state", len = self.bytecode.len(), "Writing bytecodes");
|
||||
let mut bytecodes_cursor = tx.cursor_write::<tables::Bytecodes>()?;
|
||||
for (hash, bytecode) in self.bytecode.into_iter() {
|
||||
bytecodes_cursor.upsert(hash, bytecode)?;
|
||||
}
|
||||
|
||||
// Write the receipts of the transactions
|
||||
tracing::trace!(target: "provider::post_state", len = self.receipts.len(), "Writing receipts");
|
||||
let mut bodies_cursor = tx.cursor_read::<tables::BlockBodyIndices>()?;
|
||||
let mut receipts_cursor = tx.cursor_write::<tables::Receipts>()?;
|
||||
for (block, receipts) in self.receipts {
|
||||
|
||||
@ -183,6 +183,8 @@ where
|
||||
|
||||
/// Unwind table by some number key.
|
||||
/// Returns number of rows unwound.
|
||||
///
|
||||
/// Note: Key is not inclusive and specified key would stay in db.
|
||||
#[inline]
|
||||
pub fn unwind_table_by_num<T>(&self, num: u64) -> Result<usize, DbError>
|
||||
where
|
||||
@ -192,7 +194,7 @@ where
|
||||
self.unwind_table::<T, _>(num, |key| key)
|
||||
}
|
||||
|
||||
/// Unwind the table to a provided block.
|
||||
/// Unwind the table to a provided number key.
|
||||
/// Returns number of rows unwound.
|
||||
///
|
||||
/// Note: Key is not inclusive and specified key would stay in db.
|
||||
|
||||
Reference in New Issue
Block a user