mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
More logging around self destruct
This commit is contained in:
parent
6c707504ff
commit
713f67421e
3 changed files with 6 additions and 4 deletions
|
|
@ -887,8 +887,6 @@ func (s *StateDB) SetStorage(addr common.Address, storage map[common.Hash]common
|
|||
// The account's state object is still available until the state is committed,
|
||||
// getStateObject will return a non-nil account after SelfDestruct.
|
||||
func (s *StateDB) SelfDestruct(addr common.Address) uint256.Int {
|
||||
fmt.Fprintf(os.Stderr, "[Firehose] SelfDestruct called (addr=%s)\n", addr)
|
||||
|
||||
stateObject := s.getStateObject(addr)
|
||||
var prevBalance uint256.Int
|
||||
if stateObject == nil {
|
||||
|
|
@ -918,8 +916,6 @@ func (s *StateDB) SelfDestruct(addr common.Address) uint256.Int {
|
|||
}
|
||||
|
||||
func (s *StateDB) SelfDestruct6780(addr common.Address) (uint256.Int, bool) {
|
||||
fmt.Fprintf(os.Stderr, "[Firehose] SelfDestruct6780 called (addr=%s)\n", addr)
|
||||
|
||||
stateObject := s.getStateObject(addr)
|
||||
if stateObject == nil {
|
||||
fmt.Fprintf(os.Stderr, "[Firehose] SelfDestruct6780: stateObject is nil (addr=%s)\n", addr)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@
|
|||
package state
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -257,6 +259,7 @@ func (s *hookedStateDB) SelfDestruct6780(address common.Address) (uint256.Int, b
|
|||
prev, changed := s.inner.SelfDestruct6780(address)
|
||||
|
||||
if s.hooks.OnBalanceChange != nil && changed && !prev.IsZero() {
|
||||
fmt.Fprintf(os.Stderr, "[Firehose] SelfDestruct6780 (hooked): previous balance withdraw (addr=%s, prev_balance=%s)\n", address, &prev)
|
||||
s.hooks.OnBalanceChange(address, prev.ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestruct)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@
|
|||
package vm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/tracing"
|
||||
|
|
@ -1009,6 +1011,7 @@ func opSelfdestruct6780(pc *uint64, interpreter *EVMInterpreter, scope *ScopeCon
|
|||
}
|
||||
beneficiary := scope.Stack.pop()
|
||||
balance := interpreter.evm.StateDB.GetBalance(scope.Contract.Address())
|
||||
fmt.Fprintf(os.Stderr, "[Firehose] SelfDestruct6780 (instructions): previous balance withdraw (addr=%s, prev_balance=%s)\n", scope.Contract.Address(), balance)
|
||||
interpreter.evm.StateDB.SubBalance(scope.Contract.Address(), balance, tracing.BalanceDecreaseSelfdestruct)
|
||||
interpreter.evm.StateDB.AddBalance(beneficiary.Bytes20(), balance, tracing.BalanceIncreaseSelfdestruct)
|
||||
interpreter.evm.StateDB.SelfDestruct6780(scope.Contract.Address())
|
||||
|
|
|
|||
Loading…
Reference in a new issue