mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 03:51:20 +00:00
b8c6a4d263
Splitting function `CaptureStart` into `CaptureStart` (when depth == 0) and `CaptureEnter` (when depth > 0), while removing argument `depth`. Same with splitting `CaptureEnd` into `CaptureEnd` and `CaptureExit` Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package commands
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"github.com/holiman/uint256"
|
|
"github.com/ledgerwatch/erigon/common"
|
|
"github.com/ledgerwatch/erigon/core/vm"
|
|
)
|
|
|
|
type TouchTracer struct {
|
|
DefaultTracer
|
|
searchAddr common.Address
|
|
Found bool
|
|
}
|
|
|
|
func NewTouchTracer(searchAddr common.Address) *TouchTracer {
|
|
return &TouchTracer{
|
|
searchAddr: searchAddr,
|
|
}
|
|
}
|
|
|
|
func (t *TouchTracer) captureStartOrEnter(from, to common.Address) {
|
|
if !t.Found && (bytes.Equal(t.searchAddr.Bytes(), from.Bytes()) || bytes.Equal(t.searchAddr.Bytes(), to.Bytes())) {
|
|
t.Found = true
|
|
}
|
|
}
|
|
|
|
func (t *TouchTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, precompile bool, create bool, calltype vm.CallType, input []byte, gas uint64, value *uint256.Int, code []byte) {
|
|
t.captureStartOrEnter(from, to)
|
|
}
|
|
|
|
func (t *TouchTracer) CaptureEnter(env *vm.EVM, from common.Address, to common.Address, precompile bool, create bool, calltype vm.CallType, input []byte, gas uint64, value *uint256.Int, code []byte) {
|
|
t.captureStartOrEnter(from, to)
|
|
}
|