p2p: Ignore non-version msgs before version msg

Sending a non-version message before the initial version message is peer
misbehavior. Though, it seems arbitrary and confusing to disconnect only
after exactly 100 non-version messages. So remove the Misbehaving and
instead rely on the existing disconnect-due-to-handshake-timeout logic.
This commit is contained in:
MarcoFalke
2020-10-04 17:34:26 +02:00
parent ea7926527c
commit fad68afcff
3 changed files with 6 additions and 21 deletions

View File

@@ -2477,7 +2477,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
if (pfrom.nVersion == 0) {
// Must have a version message before anything else
Misbehaving(pfrom.GetId(), 1, "non-version message before version handshake");
LogPrint(BCLog::NET, "non-version message before version handshake. Message \"%s\" from peer=%d\n", SanitizeString(msg_type), pfrom.GetId());
return;
}