use crate::{hash_builder::HashBuilder, trie_cursor::CursorSubNode, updates::TrieUpdates};
use alloy_primitives::B256;
use reth_stages_types::MerkleCheckpoint;
#[derive(Debug)]
pub enum StateRootProgress {
Complete(B256, usize, TrieUpdates),
Progress(Box<IntermediateStateRootState>, usize, TrieUpdates),
}
#[derive(Debug)]
pub struct IntermediateStateRootState {
pub hash_builder: HashBuilder,
pub walker_stack: Vec<CursorSubNode>,
pub last_account_key: B256,
}
impl From<MerkleCheckpoint> for IntermediateStateRootState {
fn from(value: MerkleCheckpoint) -> Self {
Self {
hash_builder: HashBuilder::from(value.state),
walker_stack: value.walker_stack.into_iter().map(CursorSubNode::from).collect(),
last_account_key: value.last_account_key,
}
}
}