Revert "Get only valid blocks. (#4628)"

This reverts commit f0dc999e1b.
revert-4628-fix/only-valid-blocks
Konstantin 9 months ago committed by GitHub
parent f0dc999e1b
commit d1b9c0e1a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      consensus/fbft_log.go
  2. 4
      consensus/view_change_msg.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)
}
}

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

Loading…
Cancel
Save