Skip to content

Commit

Permalink
fix: reintroduce #908 (#1617)
Browse files Browse the repository at this point in the history
this contribution was mistakenly removed by #871
  • Loading branch information
marcospb19-cw authored Aug 7, 2024
1 parent 1e06e3a commit 92041c0
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/eth/storage/rocks/rocks_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,23 @@ impl RocksStorageState {
let mut account_history_changes = Vec::new();

for change in changes {
let address: AddressRocksdb = change.address.into();
let mut account_info_entry = accounts.get_or_insert_with(address, AccountRocksdb::default)?;
if change.is_account_modified() {
let address: AddressRocksdb = change.address.into();
let mut account_info_entry = accounts.get_or_insert_with(address, AccountRocksdb::default)?;

if let Some(nonce) = change.nonce.clone().take_modified() {
account_info_entry.nonce = nonce.into();
}
if let Some(balance) = change.balance.clone().take_modified() {
account_info_entry.balance = balance.into();
}
if let Some(bytecode) = change.bytecode.clone().take_modified() {
account_info_entry.bytecode = bytecode.map_into();
}
if let Some(nonce) = change.nonce.clone().take_modified() {
account_info_entry.nonce = nonce.into();
}
if let Some(balance) = change.balance.clone().take_modified() {
account_info_entry.balance = balance.into();
}
if let Some(bytecode) = change.bytecode.clone().take_modified() {
account_info_entry.bytecode = bytecode.map_into();
}

account_changes.push((address, account_info_entry.clone()));
account_history_changes.push(((address, block_number.into()), account_info_entry));
account_changes.push((address, account_info_entry.clone()));
account_history_changes.push(((address, block_number.into()), account_info_entry));
}
}

accounts.prepare_batch_insertion(account_changes, batch)?;
Expand Down

0 comments on commit 92041c0

Please sign in to comment.