From abc7885056bc39ed48679f1f42b434fb423725ca Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 25 Jan 2021 16:47:01 +0300 Subject: [PATCH] [#324] ir: Register block handler before starting the listening routine Signed-off-by: Leonard Lyubich --- pkg/innerring/innerring.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 691e8bec..df3cfa8e 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -118,9 +118,6 @@ func (s *Server) Start(ctx context.Context, intError chan<- error) error { } }() - go s.morphListener.ListenWithError(ctx, morphErr) // listen for neo:morph events - go s.mainnetListener.ListenWithError(ctx, mainnnetErr) // listen for neo:mainnet events - s.morphListener.RegisterBlockHandler(func(b *block.Block) { s.log.Debug("new block", zap.Uint32("index", b.Index), @@ -129,6 +126,9 @@ func (s *Server) Start(ctx context.Context, intError chan<- error) error { s.tickTimers() }) + go s.morphListener.ListenWithError(ctx, morphErr) // listen for neo:morph events + go s.mainnetListener.ListenWithError(ctx, mainnnetErr) // listen for neo:mainnet events + if err := s.startBlockTimers(); err != nil { return errors.Wrap(err, "could not start block timers") }