Skip to content

Commit 869c9f8

Browse files
committed
fixes
1 parent d78a087 commit 869c9f8

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

crates/evm/src/eth/block.rs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,30 @@ where
264264
if let Some(alloy_bal) = self.evm.db_mut().take_built_alloy_bal() {
265265
if let Some(withdrawals) = self.ctx.withdrawals.as_deref() {
266266
for withdrawal in withdrawals.iter() {
267-
let initial = self
268-
.evm
269-
.db_mut()
270-
.database
271-
.basic(withdrawal.address)
272-
.unwrap()
273-
.unwrap_or_default()
274-
.balance;
267+
let initial = if let Some(account_changes) =
268+
alloy_bal.iter().find(|ac| ac.address == withdrawal.address)
269+
{
270+
if let Some(last_balance) = account_changes.balance_changes.last() {
271+
last_balance.post_balance
272+
} else {
273+
self.evm
274+
.db_mut()
275+
.database
276+
.basic(withdrawal.address)
277+
.unwrap()
278+
.unwrap_or_default()
279+
.balance
280+
}
281+
} else {
282+
self.evm
283+
.db_mut()
284+
.database
285+
.basic(withdrawal.address)
286+
.unwrap()
287+
.unwrap_or_default()
288+
.balance
289+
};
290+
275291
let final_balance = initial
276292
.saturating_add(U256::from(withdrawal.amount_wei().to::<u128>()));
277293
if initial != final_balance {

0 commit comments

Comments
 (0)