mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 6bc1eca01b into merged_master (Bitcoin PR bitcoin/bitcoin#22144)
This commit is contained in:
commit
ebffc84d07
1 changed files with 6 additions and 0 deletions
|
|
@ -2213,6 +2213,7 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
|
|||
|
||||
void CConnman::ThreadMessageHandler()
|
||||
{
|
||||
FastRandomContext rng;
|
||||
while (!flagInterruptMsgProc)
|
||||
{
|
||||
std::vector<CNode*> vNodesCopy;
|
||||
|
|
@ -2226,6 +2227,11 @@ void CConnman::ThreadMessageHandler()
|
|||
|
||||
bool fMoreWork = false;
|
||||
|
||||
// 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.
|
||||
Shuffle(vNodesCopy.begin(), vNodesCopy.end(), rng);
|
||||
|
||||
for (CNode* pnode : vNodesCopy)
|
||||
{
|
||||
if (pnode->fDisconnect)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue