Skip to main content

merge_changes

Function merge_changes 

Source
pub fn merge_changes<'c>(
    state: &mut State<'_>,
    changes: impl Iterator<Item = AccountChanges<'c>>,
    filter: impl Fn(&Address) -> bool,
    persistent: Option<&mut Vec<PersistentWrite>>,
    source: Option<&mut CacheDB<Box<dyn DynDatabase + '_>>>,
) -> DbResult<Vec<PersistentWrite>>
Expand description

Applies a nested transaction’s changes to the accounts selected by filter to state as journaled writes, also recorded in persistent if given.

Changes only carry changed code, so the code of an account whose code hash differs from state’s is read from source, the nested transaction’s database. Without one, the nested transaction ran over a copy of state, where an unchanged code hash is already state’s.

Returns a PersistentWrite::ReloadDiscarded for each account whose storage a journaled creation discarded, for the caller to replay when an enclosing call reverts.