Added HookTester back into main.
This commit is contained in:
		
							parent
							
								
									1bf1a5634e
								
							
						
					
					
						commit
						fee25089a9
					
				| @ -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) | ||||
| } | ||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @ -126,5 +126,3 @@ require ( | ||||
| 	gopkg.in/yaml.v3 v3.0.1 // indirect | ||||
| 	rsc.io/tmplfunc v0.0.3 // indirect | ||||
| ) | ||||
| 
 | ||||
| replace github.com/openrelayxyz/plugeth-utils => /home/philip/src/rivet/plugeth_superspace/plugeth-utils | ||||
|  | ||||
| @ -63,6 +63,9 @@ func (r *serviceRegistry) registerName(name string, rcvr interface{}) error { | ||||
| 		return fmt.Errorf("no service name for type %s", rcvrVal.Type().String()) | ||||
| 	} | ||||
| 	callbacks := suitableCallbacks(rcvrVal) | ||||
| 	// begin PluGeth code injection
 | ||||
| 	pluginExtendedCallbacks(callbacks, rcvrVal) | ||||
| 	// end PluGeth code injection
 | ||||
| 	if len(callbacks) == 0 { | ||||
| 		return fmt.Errorf("service %T doesn't have any suitable methods/subscriptions to expose", rcvr) | ||||
| 	} | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user