diff --git a/plugins/analysis/client/plugin.go b/plugins/analysis/client/plugin.go index 15fdec672cb2551262fcbb7e19c0e03d874ec262..ad94d1013753338885569ef10b9f8ade44add0c9 100644 --- a/plugins/analysis/client/plugin.go +++ b/plugins/analysis/client/plugin.go @@ -62,11 +62,13 @@ func run(_ *node.Plugin) { if err := daemon.BackgroundWorker(PluginName, func(shutdownSignal <-chan struct{}) { - fpctest.Voter().Events().Finalized.Attach(events.NewClosure(onFinalized)) - defer fpctest.Voter().Events().Finalized.Detach(events.NewClosure(onFinalized)) + onFinalizedClosure := events.NewClosure(onFinalized) + fpctest.Voter().Events().Finalized.Attach(onFinalizedClosure) + defer fpctest.Voter().Events().Finalized.Detach(onFinalizedClosure) - fpctest.Voter().Events().RoundExecuted.Attach(events.NewClosure(onRoundExecuted)) - defer fpctest.Voter().Events().RoundExecuted.Detach(events.NewClosure(onRoundExecuted)) + onRoundExecutedClosure := events.NewClosure(onRoundExecuted) + fpctest.Voter().Events().RoundExecuted.Attach(onRoundExecutedClosure) + defer fpctest.Voter().Events().RoundExecuted.Detach(onRoundExecutedClosure) ticker := time.NewTicker(reportIntervalSec * time.Second) defer ticker.Stop()