From d1b9c0e1a18b76191eb657bc550713c44ee15832 Mon Sep 17 00:00:00 2001 From: Konstantin <355847+Frozen@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:11:07 -0400 Subject: [PATCH] Revert "Get only valid blocks. (#4628)" This reverts commit f0dc999e1bed55b1a08749b99303f0336164ed5e. --- consensus/fbft_log.go | 13 ++----------- consensus/view_change_msg.go | 4 +--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/consensus/fbft_log.go b/consensus/fbft_log.go index 34637183a..982aecab7 100644 --- a/consensus/fbft_log.go +++ b/consensus/fbft_log.go @@ -222,20 +222,11 @@ func (log *FBFTLog) GetMessagesByTypeSeqViewHash(typ msg_pb.MessageType, blockNu return found } -func (log *FBFTLog) all(filters []func(*FBFTMessage, *FBFTLog) bool, value *FBFTMessage) bool { - for _, filter := range filters { - if !filter(value, log) { - return false - } - } - return true -} - // GetMessagesByTypeSeq returns pbft messages with matching type, blockNum -func (log *FBFTLog) GetMessagesByTypeSeq(typ msg_pb.MessageType, blockNum uint64, filters ...func(message *FBFTMessage, log *FBFTLog) bool) []*FBFTMessage { +func (log *FBFTLog) GetMessagesByTypeSeq(typ msg_pb.MessageType, blockNum uint64) []*FBFTMessage { var found []*FBFTMessage for _, msg := range log.messages { - if msg.MessageType == typ && msg.BlockNum == blockNum && msg.Verified && log.all(filters, msg) { + if msg.MessageType == typ && msg.BlockNum == blockNum && msg.Verified { found = append(found, msg) } } diff --git a/consensus/view_change_msg.go b/consensus/view_change_msg.go index 8272134c5..6c4b08005 100644 --- a/consensus/view_change_msg.go +++ b/consensus/view_change_msg.go @@ -33,9 +33,7 @@ func (consensus *Consensus) constructViewChangeMessage(priKey *bls.PrivateKeyWra } preparedMsgs := consensus.fBFTLog.GetMessagesByTypeSeq( - msg_pb.MessageType_PREPARED, consensus.getBlockNum(), func(message *FBFTMessage, log *FBFTLog) bool { - return log.IsBlockVerified(message.BlockHash) - }, + msg_pb.MessageType_PREPARED, consensus.getBlockNum(), ) preparedMsg := consensus.fBFTLog.FindMessageByMaxViewID(preparedMsgs)