From c7efabf8d672c8198153abe961c88151def1c403 Mon Sep 17 00:00:00 2001 From: philip-morlier Date: Thu, 7 Dec 2023 13:03:43 -0800 Subject: [PATCH] Added InitializeNode converage to test plugin --- plugins/test-plugin/hooks.go | 11 +++++++++++ plugins/test-plugin/main.go | 2 ++ 2 files changed, 13 insertions(+) diff --git a/plugins/test-plugin/hooks.go b/plugins/test-plugin/hooks.go index 417eafeed..47f8249ed 100644 --- a/plugins/test-plugin/hooks.go +++ b/plugins/test-plugin/hooks.go @@ -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{}{}, diff --git a/plugins/test-plugin/main.go b/plugins/test-plugin/main.go index 3ec113d2a..30f272606 100644 --- a/plugins/test-plugin/main.go +++ b/plugins/test-plugin/main.go @@ -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"):