Skip to content

Commit

Permalink
load accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-atreya committed Oct 28, 2024
1 parent 456da15 commit b650f56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/backend/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,15 +739,15 @@ impl ForkedStorage {
accounts: BTreeMap<Address, SerializableAccountRecord>,
block_number: u64,
) {
accounts.into_iter().map(|(k, v)| {
accounts.into_iter().for_each(|(k, v)| {
let info = AccountInfo {
balance: v.balance,
nonce: v.nonce,
code_hash: KECCAK_EMPTY,
code: if v.code.is_empty() { None } else { Some(Bytecode::new_raw(v.code)) },
};

self.account_at.insert((k, block_number), info)
self.account_at.insert((k, block_number), info);
});
}
}
4 changes: 4 additions & 0 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,10 @@ impl Backend {
.into());
}

if let Some(mut fork) = self.get_fork() {
fork.load_state(state.clone());
}

if let Some(historical_states) = state.historical_states {
self.states.write().load_states(historical_states);
}
Expand Down

0 comments on commit b650f56

Please sign in to comment.