forked from cerc-io/plugeth
Added InitializeNode converage to test plugin
This commit is contained in:
parent
892f98ad6a
commit
c7efabf8d6
@ -6,6 +6,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/openrelayxyz/plugeth-utils/core"
|
"github.com/openrelayxyz/plugeth-utils/core"
|
||||||
|
"github.com/openrelayxyz/plugeth-utils/restricted"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,6 +38,15 @@ func GetAPIs(stack core.Node, backend core.Backend) []core.API {
|
|||||||
return apis
|
return apis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func InitializeNode(stack core.Node, b restricted.Backend) {
|
||||||
|
go func() {
|
||||||
|
m := map[string]struct{}{
|
||||||
|
"InitializeNode":struct{}{},
|
||||||
|
}
|
||||||
|
hookChan <- m
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
// func OnShutdown(){
|
// func OnShutdown(){
|
||||||
// this injection is covered by another test in this package. See documentation for details.
|
// this injection is covered by another test in this package. See documentation for details.
|
||||||
// }
|
// }
|
||||||
@ -250,6 +260,7 @@ func Is160(num *big.Int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var plugins map[string]struct{} = map[string]struct{}{
|
var plugins map[string]struct{} = map[string]struct{}{
|
||||||
|
"InitializeNode":struct{}{},
|
||||||
"CreateEngine":struct{}{},
|
"CreateEngine":struct{}{},
|
||||||
"OnShutdown": struct{}{},
|
"OnShutdown": struct{}{},
|
||||||
"SetTrieFlushIntervalClone":struct{}{},
|
"SetTrieFlushIntervalClone":struct{}{},
|
||||||
|
@ -53,6 +53,8 @@ func BlockChain() {
|
|||||||
var ok bool
|
var ok bool
|
||||||
f := func(key string) bool {_, ok = m[key]; return ok}
|
f := func(key string) bool {_, ok = m[key]; return ok}
|
||||||
switch {
|
switch {
|
||||||
|
case f("InitializeNode"):
|
||||||
|
delete(plugins, "InitializeNode")
|
||||||
case f("CreateEngine"):
|
case f("CreateEngine"):
|
||||||
delete(plugins, "CreateEngine")
|
delete(plugins, "CreateEngine")
|
||||||
case f("OnShutdown"):
|
case f("OnShutdown"):
|
||||||
|
Loading…
Reference in New Issue
Block a user