mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-28 16:48:13 -05:00
fix(stages): clear pre-eip161 accounts (#1747)
This commit is contained in:
@@ -185,7 +185,7 @@ where
|
||||
new: to_reth_acc(&account.info),
|
||||
}
|
||||
} else {
|
||||
AccountInfoChangeSet::NoChange
|
||||
AccountInfoChangeSet::NoChange { is_empty: account.is_empty() }
|
||||
};
|
||||
entry.info = account.info.clone();
|
||||
(account_changeset, entry)
|
||||
@@ -709,7 +709,7 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
changesets.changeset.get(&account1).unwrap().account,
|
||||
AccountInfoChangeSet::NoChange,
|
||||
AccountInfoChangeSet::NoChange { is_empty: false },
|
||||
"No change to account"
|
||||
);
|
||||
assert_eq!(
|
||||
|
||||
@@ -53,7 +53,10 @@ pub enum AccountInfoChangeSet {
|
||||
old: Account,
|
||||
},
|
||||
/// Nothing was changed for the account (nonce/balance).
|
||||
NoChange,
|
||||
NoChange {
|
||||
/// Useful to clear existing empty accounts pre-EIP-161.
|
||||
is_empty: bool,
|
||||
},
|
||||
}
|
||||
|
||||
impl AccountInfoChangeSet {
|
||||
@@ -94,8 +97,10 @@ impl AccountInfoChangeSet {
|
||||
AccountBeforeTx { address, info: Some(old) },
|
||||
)?;
|
||||
}
|
||||
AccountInfoChangeSet::NoChange => {
|
||||
// do nothing storage account didn't change
|
||||
AccountInfoChangeSet::NoChange { is_empty } => {
|
||||
if has_state_clear_eip && is_empty {
|
||||
tx.delete::<tables::PlainAccountState>(address, None)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user