mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-04 18:35:03 +00:00
eth/tracers: add basic native loader
This commit is contained in:
parent
48496e0675
commit
af67e1def6
1 changed files with 18 additions and 0 deletions
18
eth/tracers/native/native.go
Normal file
18
eth/tracers/native/native.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package native
|
||||
|
||||
import "github.com/ethereum/go-ethereum/core/vm"
|
||||
|
||||
type Constructor func() vm.Tracer
|
||||
|
||||
var tracers map[string]Constructor = make(map[string]Constructor)
|
||||
|
||||
func Register(name string, fn Constructor) {
|
||||
tracers[name] = fn
|
||||
}
|
||||
|
||||
func New(name string) (vm.Tracer, bool) {
|
||||
if fn, ok := tracers[name]; ok {
|
||||
return fn(), true
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
Loading…
Reference in a new issue