Added InitializeNode converage to test plugin

This commit is contained in:
philip-morlier
2023-12-07 13:03:43 -08:00
parent 892f98ad6a
commit c7efabf8d6
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -6,6 +6,7 @@ import (
"sync"
"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
}
func InitializeNode(stack core.Node, b restricted.Backend) {
go func() {
m := map[string]struct{}{
"InitializeNode":struct{}{},
}
hookChan <- m
}()
}
// func OnShutdown(){
// 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{}{
"InitializeNode":struct{}{},
"CreateEngine":struct{}{},
"OnShutdown": struct{}{},
"SetTrieFlushIntervalClone":struct{}{},
+2
View File
@@ -53,6 +53,8 @@ func BlockChain() {
var ok bool
f := func(key string) bool {_, ok = m[key]; return ok}
switch {
case f("InitializeNode"):
delete(plugins, "InitializeNode")
case f("CreateEngine"):
delete(plugins, "CreateEngine")
case f("OnShutdown"):