fix: add logging of peer ip and the node id signing the message if handshake is not done

This commit is contained in:
Derrick Hammer 2024-03-10 09:17:13 -04:00
parent bb1b43958a
commit ee6f140b7e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 1 deletions

View File

@ -94,7 +94,11 @@ func (s *SignedMessage) HandleMessage(message IncomingMessageData) error {
if msgHandler, valid := GetSignedMessageType(payload.kind); valid {
logger.Debug("SignedMessage", zap.Any("type", types.ProtocolMethodMap[types.ProtocolMethod(payload.kind)]))
if msgHandler.RequiresHandshake() && !peer.IsHandshakeDone() {
logger.Debug("Peer is not handshake done, ignoring message", zap.Any("type", types.ProtocolMethodMap[types.ProtocolMethod(payload.kind)]))
nid, err := s.nodeId.ToString()
if err != nil {
return err
}
logger.Debug("Peer is not handshake done, ignoring message", zap.Any("type", types.ProtocolMethodMap[types.ProtocolMethod(payload.kind)]), zap.String("peerIP", peer.GetIPString()), zap.String("nodeId", nid))
return nil
}