mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 07:23:46 +00:00
move live directory to main directory module
This commit is contained in:
parent
b267363c65
commit
d267c7d976
4 changed files with 12 additions and 12 deletions
|
|
@ -52,7 +52,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/eth/filters"
|
"github.com/ethereum/go-ethereum/eth/filters"
|
||||||
"github.com/ethereum/go-ethereum/eth/gasprice"
|
"github.com/ethereum/go-ethereum/eth/gasprice"
|
||||||
"github.com/ethereum/go-ethereum/eth/tracers"
|
"github.com/ethereum/go-ethereum/eth/tracers"
|
||||||
"github.com/ethereum/go-ethereum/eth/tracers/directory/live"
|
"github.com/ethereum/go-ethereum/eth/tracers/directory"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/ethdb/remotedb"
|
"github.com/ethereum/go-ethereum/ethdb/remotedb"
|
||||||
"github.com/ethereum/go-ethereum/ethstats"
|
"github.com/ethereum/go-ethereum/ethstats"
|
||||||
|
|
@ -2215,7 +2215,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
|
||||||
if ctx.IsSet(VMTraceConfigFlag.Name) {
|
if ctx.IsSet(VMTraceConfigFlag.Name) {
|
||||||
config = json.RawMessage(ctx.String(VMTraceConfigFlag.Name))
|
config = json.RawMessage(ctx.String(VMTraceConfigFlag.Name))
|
||||||
}
|
}
|
||||||
t, err := live.Directory.New(name, config)
|
t, err := directory.LiveDirectory.New(name, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatalf("Failed to create tracer %q: %v", name, err)
|
Fatalf("Failed to create tracer %q: %v", name, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/eth/gasprice"
|
"github.com/ethereum/go-ethereum/eth/gasprice"
|
||||||
"github.com/ethereum/go-ethereum/eth/protocols/eth"
|
"github.com/ethereum/go-ethereum/eth/protocols/eth"
|
||||||
"github.com/ethereum/go-ethereum/eth/protocols/snap"
|
"github.com/ethereum/go-ethereum/eth/protocols/snap"
|
||||||
"github.com/ethereum/go-ethereum/eth/tracers/directory/live"
|
"github.com/ethereum/go-ethereum/eth/tracers/directory"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
|
|
@ -212,7 +212,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
if config.VMTraceConfig != "" {
|
if config.VMTraceConfig != "" {
|
||||||
traceConfig = json.RawMessage(config.VMTraceConfig)
|
traceConfig = json.RawMessage(config.VMTraceConfig)
|
||||||
}
|
}
|
||||||
t, err := live.Directory.New(config.VMTrace, traceConfig)
|
t, err := directory.LiveDirectory.New(config.VMTrace, traceConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Failed to create tracer %s: %v", config.VMTrace, err)
|
return nil, fmt.Errorf("Failed to create tracer %s: %v", config.VMTrace, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package live
|
package directory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
@ -9,21 +9,21 @@ import (
|
||||||
|
|
||||||
type ctorFunc func(config json.RawMessage) (*tracing.Hooks, error)
|
type ctorFunc func(config json.RawMessage) (*tracing.Hooks, error)
|
||||||
|
|
||||||
// Directory is the collection of tracers which can be used
|
// LiveDirectory is the collection of tracers which can be used
|
||||||
// during normal block import operations.
|
// during normal block import operations.
|
||||||
var Directory = directory{elems: make(map[string]ctorFunc)}
|
var LiveDirectory = liveDirectory{elems: make(map[string]ctorFunc)}
|
||||||
|
|
||||||
type directory struct {
|
type liveDirectory struct {
|
||||||
elems map[string]ctorFunc
|
elems map[string]ctorFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register registers a tracer constructor by name.
|
// Register registers a tracer constructor by name.
|
||||||
func (d *directory) Register(name string, f ctorFunc) {
|
func (d *liveDirectory) Register(name string, f ctorFunc) {
|
||||||
d.elems[name] = f
|
d.elems[name] = f
|
||||||
}
|
}
|
||||||
|
|
||||||
// New instantiates a tracer by name.
|
// New instantiates a tracer by name.
|
||||||
func (d *directory) New(name string, config json.RawMessage) (*tracing.Hooks, error) {
|
func (d *liveDirectory) New(name string, config json.RawMessage) (*tracing.Hooks, error) {
|
||||||
if f, ok := d.elems[name]; ok {
|
if f, ok := d.elems[name]; ok {
|
||||||
return f(config)
|
return f(config)
|
||||||
}
|
}
|
||||||
|
|
@ -7,12 +7,12 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/tracing"
|
"github.com/ethereum/go-ethereum/core/tracing"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/eth/tracers/directory/live"
|
"github.com/ethereum/go-ethereum/eth/tracers/directory"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
live.Directory.Register("noop", newNoopTracer)
|
directory.LiveDirectory.Register("noop", newNoopTracer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// noop is a no-op live tracer. It's there to
|
// noop is a no-op live tracer. It's there to
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue