Skip to main content

merge_pending_changes

Function merge_pending_changes 

Source
pub fn merge_pending_changes(
    state: &mut State<'_>,
    pending: &PendingState,
    destructed: AddressMap<DestructedAccount>,
    kept: impl Fn(&AccountChanges<'_>) -> bool,
    persistent: Option<&mut Vec<PersistentWrite>>,
) -> DbResult<()>
Expand description

Applies the changes of a nested transaction detached into pending to the running transaction’s state as journaled writes, so they revert with the enclosing call.

An account the nested transaction self-destructed and kept selects keeps the state the transaction left it in until the running transaction ends and destroys it: it takes the state of destructed, see destructed_accounts, and is only marked self-destructed. Without one, its balance is emptied and the rest of its state is kept.