functional test plugin.
This PR will also include the stand alone tests.
This commit is contained in:
parent
8a33d8e506
commit
b3f1d35171
@ -357,7 +357,6 @@ func geth(ctx *cli.Context) error {
|
||||
stack.RegisterAPIs(pluginGetAPIs(stack, wrapperBackend))
|
||||
startNode(ctx, stack, backend, false)
|
||||
pluginBlockChain()
|
||||
pluginHookTester()
|
||||
//end PluGeth code injection
|
||||
stack.Wait()
|
||||
return nil
|
||||
|
@ -86,7 +86,6 @@ func pluginsInitializeNode(stack *node.Node, backend restricted.Backend) {
|
||||
}
|
||||
|
||||
func OnShutdown(pl *plugins.PluginLoader) {
|
||||
log.Error("inside of on shutdown")
|
||||
fnList := pl.Lookup("OnShutdown", func(item interface{}) bool {
|
||||
_, ok := item.(func())
|
||||
return ok
|
||||
@ -120,22 +119,4 @@ func pluginBlockChain() {
|
||||
return
|
||||
}
|
||||
BlockChain(plugins.DefaultPluginLoader)
|
||||
}
|
||||
|
||||
func HookTester(pl *plugins.PluginLoader) {
|
||||
fnList := pl.Lookup("HookTester", func(item interface{}) bool {
|
||||
_, ok := item.(func())
|
||||
return ok
|
||||
})
|
||||
for _, fni := range fnList {
|
||||
fni.(func())()
|
||||
}
|
||||
}
|
||||
|
||||
func pluginHookTester() {
|
||||
if plugins.DefaultPluginLoader == nil {
|
||||
log.Warn("Attempting HookTester, but default PluginLoader has not been initialized")
|
||||
return
|
||||
}
|
||||
HookTester(plugins.DefaultPluginLoader)
|
||||
}
|
@ -1333,7 +1333,6 @@ func (bc *BlockChain) writeKnownBlock(block *types.Block) error {
|
||||
// writeBlockWithState writes block, metadata and corresponding state data to the
|
||||
// database.
|
||||
func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) error {
|
||||
log.Error("inside of the target function")
|
||||
// Calculate the total difficulty of the block
|
||||
ptd := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
|
||||
if ptd == nil {
|
||||
|
@ -125,7 +125,6 @@ func PluginNewHead(pl *plugins.PluginLoader, block *types.Block, hash common.Has
|
||||
_, ok := item.(func([]byte, core.Hash, [][]byte, *big.Int))
|
||||
return ok
|
||||
})
|
||||
log.Error("inside of pluginNewHead()", "len fnList", len(fnList))
|
||||
blockBytes, _ := rlp.EncodeToBytes(block)
|
||||
logBytes := make([][]byte, len(logs))
|
||||
for i, l := range logs {
|
||||
|
@ -956,17 +956,14 @@ func (api *API) traceTx(ctx context.Context, message *core.Message, txctx *Conte
|
||||
if config == nil {
|
||||
config = &TraceConfig{}
|
||||
}
|
||||
log.Error("outside of geth condition", "config", config.Tracer)
|
||||
// Default tracer is the struct logger
|
||||
tracer = logger.NewStructLogger(config.Config)
|
||||
if config.Tracer != nil {
|
||||
// Get the tracer from the plugin loader
|
||||
//begin PluGeth code injection
|
||||
if tr, ok := getPluginTracer(*config.Tracer); ok {
|
||||
log.Error("inside geth", "tracer config", *config.Tracer)
|
||||
tracer = tr(statedb, vmctx)
|
||||
} else {
|
||||
log.Error("default geth condition", "config", config.Tracer)
|
||||
tracer, err = DefaultDirectory.New(*config.Tracer, txctx, config.TracerConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"reflect"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/plugins"
|
||||
)
|
||||
|
||||
|
||||
@ -121,7 +122,24 @@ func callbackifyChanPubSub(receiver, fn reflect.Value) *callback {
|
||||
return c
|
||||
}
|
||||
|
||||
func RPCSubscription(pl *plugins.PluginLoader) {
|
||||
fnList := pl.Lookup("RPCSubscriptionTest", func(item interface{}) bool {
|
||||
_, ok := item.(func())
|
||||
return ok
|
||||
})
|
||||
for _, fni := range fnList {
|
||||
if fn, ok := fni.(func()); ok {
|
||||
fn()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func pluginExtendedCallbacks(callbacks map[string]*callback, receiver reflect.Value) {
|
||||
if plugins.DefaultPluginLoader == nil {
|
||||
log.Warn("Attempting RPCSubscriptionTest, but default PluginLoader has not been initialized")
|
||||
return
|
||||
}
|
||||
RPCSubscription(plugins.DefaultPluginLoader)
|
||||
typ := receiver.Type()
|
||||
for m := 0; m < typ.NumMethod(); m++ {
|
||||
method := typ.Method(m)
|
||||
|
Loading…
Reference in New Issue
Block a user