diff --git a/src/net.cpp b/src/net.cpp index e8f693c11..d84a28710 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1945,6 +1945,11 @@ void ThreadMessageHandler() bool fSleep = true; + // Randomize the order in which we process messages from/to our peers. + // This prevents attacks in which an attacker exploits having multiple + // consecutive connections in the vNodes list. + random_shuffle(vNodesCopy.begin(), vNodesCopy.end(), GetRandInt); + BOOST_FOREACH(CNode* pnode, vNodesCopy) { if (pnode->fDisconnect)