Updates to support blockupdates plugin

This makes several updates to support the blockupdates plugin.

I had to update several hooks that were using the wrong types, and
provide a way to get event.Feed objects into plugins without importing
event.Feed (which I did by having the plugin loader make them
available).
This commit is contained in:
Austin Roberts
2021-09-16 16:04:36 -05:00
parent 25af69b8e2
commit f7307d527d
4 changed files with 67 additions and 32 deletions
+18
View File
@@ -12,6 +12,7 @@ import (
"strings"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/event"
"gopkg.in/urfave/cli.v1"
)
@@ -156,3 +157,20 @@ func ParseFlags(args []string) bool {
}
return DefaultPluginLoader.ParseFlags(args)
}
type feedWrapper struct {
feed *event.Feed
}
func (f *feedWrapper) Send(item interface{}) int {
return f.feed.Send(item)
}
func (f *feedWrapper) Subscribe(ch interface{}) core.Subscription {
return f.feed.Subscribe(ch)
}
func (pl *PluginLoader) GetFeed() core.Feed {
return &feedWrapper{&event.Feed{}}
}