fix: add handshake check to unsigned messages as well

This commit is contained in:
Derrick Hammer 2024-02-28 14:13:44 -05:00
parent 47c82c6a03
commit 5a0b742139
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 0 deletions

View File

@ -434,6 +434,11 @@ func (p *P2PServiceDefault) OnNewPeerListen(peer net.Peer, verifyId bool) {
return fmt.Errorf("unknown message type: %d", reader.Kind)
}
if handler.RequiresHandshake() && !peer.IsHandshakeDone() {
p.Logger().Debug("Peer is not handshake done, ignoring message", zap.Any("type", types.ProtocolMethodMap[types.ProtocolMethod(reader.Kind)]))
return nil
}
data := protocol.IncomingMessageData{
Original: message,
Data: reader.Data,