core/state: fix test by simulated opcode handler behavior

This commit is contained in:
lightclient 2026-01-16 09:47:45 -07:00
parent 9dda9f02b2
commit 82c7afcb70
No known key found for this signature in database
GPG key ID: 657913021EF45A6A

View file

@ -49,6 +49,8 @@ func TestBurn(t *testing.T) {
createAndDestroy := func(addr common.Address) {
hooked.AddBalance(addr, uint256.NewInt(100), tracing.BalanceChangeUnspecified)
hooked.CreateContract(addr)
// Simulate what the opcode handler does: clear balance before selfdestruct
hooked.SubBalance(addr, hooked.GetBalance(addr), tracing.BalanceDecreaseSelfdestruct)
hooked.SelfDestruct(addr)
// sanity-check that balance is now 0
if have, want := hooked.GetBalance(addr), new(uint256.Int); !have.Eq(want) {