Added HookTester back into main.

This commit is contained in:
philip-morlier committed 2023-06-14 22:24:08 -07:00
1 parent 1bf1a5634e
commit fee25089a9
3 files changed
+22 -2

No files matched your search

+19
View File
@@ -86,6 +86,7 @@ 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,3 +121,21 @@ func pluginBlockChain() {
}
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)
}