From 21ef2638c0ca41b1b095c126c743ba17ae4a7a86 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 28 Feb 2020 11:10:01 +0300 Subject: [PATCH] consensus: log error if GetValidators() failed --- pkg/consensus/consensus.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index fdb57dfc6..d2256f70b 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -476,16 +476,23 @@ func (s *service) getVerifiedTx(count int) []block.Transaction { } func (s *service) getValidators(txx ...block.Transaction) []crypto.PublicKey { - var pKeys []*keys.PublicKey + var ( + pKeys []*keys.PublicKey + err error + ) if len(txx) == 0 { - pKeys, _ = s.Chain.GetValidators() + pKeys, err = s.Chain.GetValidators() } else { ntxx := make([]*transaction.Transaction, len(txx)) for i := range ntxx { ntxx[i] = txx[i].(*transaction.Transaction) } - pKeys, _ = s.Chain.GetValidators(ntxx...) + pKeys, err = s.Chain.GetValidators(ntxx...) + } + + if err != nil { + s.log.Error("error while trying to get validators", zap.Error(err)) } pubs := make([]crypto.PublicKey, len(pKeys))