GetBockTracer fix

This commit is contained in:
philip-morlier 2021-11-11 14:41:27 -08:00
parent a4c88337eb
commit 4fc1f8f6b9

View File

@ -260,7 +260,6 @@ func (mt *metaTracer) CaptureExit(output []byte, gasUsed uint64, err error) {
func PluginGetBlockTracer(pl *plugins.PluginLoader, hash common.Hash, statedb *state.StateDB) *metaTracer { func PluginGetBlockTracer(pl *plugins.PluginLoader, hash common.Hash, statedb *state.StateDB) *metaTracer {
//look for a function that takes whatever the ctx provides and statedb and returns a core.blocktracer append into meta tracer //look for a function that takes whatever the ctx provides and statedb and returns a core.blocktracer append into meta tracer
log.Info("in pluginGetLiveTracer")
tracerList := plugins.Lookup("GetLiveTracer", func(item interface{}) bool { tracerList := plugins.Lookup("GetLiveTracer", func(item interface{}) bool {
_, ok := item.(func(core.Hash, core.StateDB) core.BlockTracer) _, ok := item.(func(core.Hash, core.StateDB) core.BlockTracer)
log.Info("Item is LiveTracer", "ok", ok, "type", reflect.TypeOf(item)) log.Info("Item is LiveTracer", "ok", ok, "type", reflect.TypeOf(item))
@ -280,7 +279,7 @@ func PluginGetBlockTracer(pl *plugins.PluginLoader, hash common.Hash, statedb *s
func pluginGetBlockTracer(hash common.Hash, statedb *state.StateDB) *metaTracer { func pluginGetBlockTracer(hash common.Hash, statedb *state.StateDB) *metaTracer {
if plugins.DefaultPluginLoader == nil { if plugins.DefaultPluginLoader == nil {
log.Warn("Attempting GetBlockTracer, but default PluginLoader has not been initialized") log.Warn("Attempting GetBlockTracer, but default PluginLoader has not been initialized")
return nil return &metaTracer{}
} }
return PluginGetBlockTracer(plugins.DefaultPluginLoader, hash, statedb) return PluginGetBlockTracer(plugins.DefaultPluginLoader, hash, statedb)
} }