From de203b5c76cf4b48037cdebd3946c8b18c304fd8 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 28 Jun 2022 18:39:47 +0300 Subject: [PATCH] consensus: check whether server is started before transaction handling consensus.OnTransaction is a callback, so it can be called at any time. We need to check whether service (and dBFT) is started before the subsequent transaction handling like it is done inside the OnPayload callback. --- pkg/consensus/consensus.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index 816d278f1..8c09ba212 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -414,7 +414,7 @@ func (s *service) OnPayload(cp *npayload.Extensible) error { } func (s *service) OnTransaction(tx *transaction.Transaction) { - if s.dbft != nil { + if s.dbft != nil && s.started.Load() { s.transactions <- tx } }