Tighten network ID check in handshake verification

This commit is contained in:
Denis Angell
2025-07-09 04:04:46 +02:00
parent dcfe53c479
commit 96e69a0481

View File

@@ -246,7 +246,7 @@ verifyHandshake(
if (!beast::lexicalCastChecked(nid, std::string(iter->value())))
throw std::runtime_error("Invalid peer network identifier");
if (networkID && nid != *networkID)
if (!networkID && nid != 0 || networkID && nid != *networkID)
throw std::runtime_error("Peer is on a different network");
}