Skip to content

Commit

Permalink
Doing refund on OpSuicide based on the current state size and the blo…
Browse files Browse the repository at this point in the history
…ck base fee
  • Loading branch information
gameofpointers committed Aug 21, 2024
1 parent a5f5d94 commit cdfa13c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package vm
import (
"fmt"
"math"
"math/big"

"github.com/dominant-strategies/go-quai/common"
"github.com/dominant-strategies/go-quai/core/types"
Expand Down Expand Up @@ -831,6 +832,8 @@ func opSuicide(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]
}
balance := interpreter.evm.StateDB.GetBalance(addr)
interpreter.evm.StateDB.AddBalance(beneficiaryAddr, balance)
refund := new(big.Int).Mul(interpreter.evm.Context.BaseFee, new(big.Int).SetUint64(params.CallNewAccountGas(interpreter.evm.Context.QuaiStateSize)))
interpreter.evm.StateDB.AddBalance(beneficiaryAddr, refund)
interpreter.evm.StateDB.Suicide(addr)
return nil, nil
}
Expand Down

0 comments on commit cdfa13c

Please sign in to comment.