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.
This commit is contained in:
Anna Shaleva 2022-06-28 18:39:47 +03:00
parent 2a24983727
commit de203b5c76

View file

@ -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
}
}