[validation] move newview validation to p2p layer

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3347/head
Leo Chen 4 years ago
parent 42923336c9
commit 54912716ce
  1. 5
      consensus/checks.go
  2. 6
      node/node.go

@ -206,10 +206,5 @@ func (consensus *Consensus) onNewViewSanityCheck(recvMsg *FBFTMessage) bool {
Msg("[onNewView] ViewID should be larger than the viewID of the last successful consensus")
return false
}
if !consensus.IsViewChangingMode() {
consensus.getLogger().Warn().
Msg("[onNewView] Not in ViewChanging mode, ignoring the new view message")
return false
}
return true
}

@ -456,6 +456,12 @@ func (node *Node) validateShardBoundMessage(
case msg_pb.MessageType_PREPARE, msg_pb.MessageType_COMMIT:
return nil, nil, true, nil
}
} else {
// ignore newview message if the node is not in viewchanging mode
switch m.Type {
case msg_pb.MessageType_NEWVIEW:
return nil, nil, true, nil
}
}
// ignore message not intended for leader, but still forward them to the network

Loading…
Cancel
Save