Skip to content

Commit 32f357f

Browse files
authored
fix(inspector): always call selfdestruct if entry is made (#1746)
Signed-off-by: jsvisa <delweng@gmail.com>
1 parent fa5650e commit 32f357f

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

crates/revm/src/inspector/handler_register.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,25 @@ pub fn inspector_handle_register<DB: Database, EXT: GetInspector<DB>>(
6767
// execute selfdestruct
6868
prev(interpreter, host);
6969
// check if selfdestruct was successful and if journal entry is made.
70-
if let Some(JournalEntry::AccountDestroyed {
71-
address,
72-
target,
73-
had_balance,
74-
..
75-
}) = host.evm.journaled_state.journal.last().unwrap().last()
76-
{
77-
host.external
78-
.get_inspector()
79-
.selfdestruct(*address, *target, *had_balance);
70+
match host.evm.journaled_state.journal.last().unwrap().last() {
71+
Some(JournalEntry::AccountDestroyed {
72+
address,
73+
target,
74+
had_balance,
75+
..
76+
}) => {
77+
host.external
78+
.get_inspector()
79+
.selfdestruct(*address, *target, *had_balance);
80+
}
81+
Some(JournalEntry::BalanceTransfer {
82+
from, to, balance, ..
83+
}) => {
84+
host.external
85+
.get_inspector()
86+
.selfdestruct(*from, *to, *balance);
87+
}
88+
_ => {}
8089
}
8190
});
8291

0 commit comments

Comments
 (0)