Make ParseFBFTMessage private.

pull/4377/head
frozen 2 years ago committed by Casey Gardiner
parent f5e2b812c5
commit 25a0655a44
  1. 2
      consensus/consensus_v2.go
  2. 2
      consensus/construct.go
  3. 6
      consensus/fbft_log.go
  4. 6
      consensus/validator.go

@ -92,7 +92,7 @@ func (consensus *Consensus) HandleMessageUpdate(ctx context.Context, msg *msg_pb
members := consensus.Decider.Participants()
fbftMsg, err = ParseNewViewMessage(msg, members)
default:
fbftMsg, err = consensus.ParseFBFTMessage(msg)
fbftMsg, err = consensus.parseFBFTMessage(msg)
}
if err != nil || fbftMsg == nil {
return errors.Wrapf(err, "unable to parse consensus msg with type: %s", msg.Type)

@ -143,7 +143,7 @@ func (consensus *Consensus) construct(
return nil, err
}
FBFTMsg, err2 := consensus.ParseFBFTMessage(message)
FBFTMsg, err2 := consensus.parseFBFTMessage(message)
if err2 != nil {
utils.Logger().Error().Err(err).

@ -287,6 +287,12 @@ func (log *FBFTLog) FindMessageByMaxViewID(msgs []*FBFTMessage) *FBFTMessage {
// ParseFBFTMessage parses FBFT message into FBFTMessage structure
func (consensus *Consensus) ParseFBFTMessage(msg *msg_pb.Message) (*FBFTMessage, error) {
consensus.mutex.Lock()
defer consensus.mutex.Unlock()
return consensus.parseFBFTMessage(msg)
}
func (consensus *Consensus) parseFBFTMessage(msg *msg_pb.Message) (*FBFTMessage, error) {
// TODO Have this do sanity checks on the message please
pbftMsg := FBFTMessage{}
pbftMsg.MessageType = msg.GetType()

@ -18,8 +18,7 @@ import (
)
func (consensus *Consensus) onAnnounce(msg *msg_pb.Message) {
recvMsg, err := consensus.ParseFBFTMessage(msg)
recvMsg, err := consensus.parseFBFTMessage(msg)
if err != nil {
consensus.getLogger().Error().
Err(err).
@ -27,9 +26,6 @@ func (consensus *Consensus) onAnnounce(msg *msg_pb.Message) {
Msg("[OnAnnounce] Unparseable leader message")
return
}
if consensus.ShardID == 0 {
//fmt.Println("onAnnounce called ", recvMsg.BlockNum)
}
// NOTE let it handle its own logs
if !consensus.onAnnounceSanityChecks(recvMsg) {

Loading…
Cancel
Save