File tree Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments