forked from cerc-io/plugeth
further progress on plugin hook
This commit is contained in:
parent
d2d3490abc
commit
9ee93f1e26
@ -6,8 +6,8 @@ import (
|
||||
"github.com/ethereum/go-ethereum/plugins"
|
||||
// "github.com/ethereum/go-ethereum/plugins/wrappers"
|
||||
// "github.com/ethereum/go-ethereum/rpc"
|
||||
// "github.com/openrelayxyz/plugeth-utils/core"
|
||||
// "github.com/openrelayxyz/plugeth-utils/restricted"
|
||||
"github.com/openrelayxyz/plugeth-utils/core"
|
||||
"github.com/openrelayxyz/plugeth-utils/restricted"
|
||||
|
||||
// "github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
@ -30,17 +30,25 @@ import (
|
||||
|
||||
// stack *node.Node, ethashConfig *ethash.Config, cliqueConfig *params.CliqueConfig, notify []string, noverify bool, db ethdb.Database) consensus.Engine
|
||||
|
||||
func engineTranslate(engine pconsensus.Engine) consensus.Engine {
|
||||
result consensus.Engine{
|
||||
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func PluginGetEngine(pl *plugins.PluginLoader, stack *node.Node, notify []string, noverify bool, db ethdb.Database) consensus.Engine {
|
||||
fnList := pl.Lookup("GetEngine", func(item interface{}) bool {
|
||||
_, ok := item.(func(*node.Node, []string, bool, ethdb.Database) consensus.Engine)
|
||||
fnList := pl.Lookup("CreateEngine", func(item interface{}) bool {
|
||||
_, ok := item.(func(*core.Node, []string, bool, restricted.Database) pconsensus.Engine)
|
||||
return ok
|
||||
})
|
||||
for _, fni := range fnList {
|
||||
if fn, ok := fni.(func(*node.Node, []string, bool, ethdb.Database)); ok { // modify
|
||||
return fn(stack, notify, noverify, db) // modify
|
||||
if fn, ok := fni.(func(*core.Node, []string, bool, restircted.Database)); ok {
|
||||
engine := fn(wrappers.NewNode(stack), notify, noverify, db) // modify
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return engineTranslate(engine)
|
||||
}
|
||||
|
||||
func pluginGetEngine(stack *node.Node, notify []string, noverify bool, db ethdb.Database) consensus.Engine {
|
||||
|
@ -17,6 +17,8 @@ import (
|
||||
ptypes "github.com/openrelayxyz/plugeth-utils/restricted/types"
|
||||
pconsensus "github.com/openrelayxyz/plugeth-utils/restricted/consensus"
|
||||
pparams "github.com/openrelayxyz/plugeth-utils/restricted/params"
|
||||
|
||||
philip "github.com/philip-morlier/butttruck"
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user