pub(crate) async fn reconstruct_state<Mode: TransactionMode>(
instance: &NodeState,
tx: &mut Transaction<Mode>,
from_height: u64,
to_view: ViewNumber,
fee_accounts: &[FeeAccount],
reward_accounts: &[RewardAccountV2],
) -> Result<(ValidatedState, Leaf2)>
Expand description
Reconstructs the ValidatedState
from a specific block height up to a given view.
This loads all required fee and reward accounts into the Merkle tree before applying the State Transition Function (STF), preventing recursive catchup during STF replay.
Note: Even if the primary goal is to catch up the block Merkle tree,
fee and reward header dependencies must still be present beforehand
This is because reconstructing the ValidatedState
involves replaying the STF over a
range of leaves, and the STF requires all associated data to be present in the ValidatedState
;
otherwise, it will attempt to trigger catchup itself.