Randomize order of processing messages from peers

This commit is contained in:
Duke
2023-03-14 14:42:39 -04:00
parent 24b3f1f93b
commit 71928fa228

View File

@@ -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)