From f81c89554e8523f63c0c53be0b4e346d07a5fc00 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Fri, 24 Jul 2020 10:35:20 +0000 Subject: [PATCH] [p2p] ignore messages not intended for explorer nodes Signed-off-by: Leo Chen --- node/node.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/node/node.go b/node/node.go index bbf9877a78..ac1d265bf0 100644 --- a/node/node.go +++ b/node/node.go @@ -363,6 +363,20 @@ func (node *Node) validateShardBoundMessage( return nil, nil, true, errors.WithStack(err) } + // ignore messages not intended for explorer + if node.NodeConfig.Role() == nodeconfig.ExplorerNode { + switch m.Type { + case + msg_pb.MessageType_ANNOUNCE, + msg_pb.MessageType_PREPARE, + msg_pb.MessageType_COMMIT, + msg_pb.MessageType_VIEWCHANGE, + msg_pb.MessageType_NEWVIEW: + atomic.AddUint32(&node.NumIgnoredMessages, 1) + return nil, nil, true, nil + } + } + // when node is in ViewChanging mode, it still accepts normal messages into FBFTLog // in order to avoid possible trap forever but drop PREPARE and COMMIT // which are message types specifically for a node acting as leader