Page MenuHomePhabricator

Randomize message processing peer order
ClosedPublic

Authored by PiRK on Mar 15 2023, 08:03.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC6038081f5548: Randomize message processing peer order
Summary

Right now, the message handling loop iterates the list of nodes always in the same order: the order they were connected in (see the vNodes vector). For some parts of the net processing logic, this order matters. Transaction requests are assigned explicitly to peers since core#19988, but many other parts of processing work on a "first-served-by-loop-first" basis, such as block downloading. If peers can predict this ordering, it may be exploited to cause delays.

As there isn't anything particularly optimal about the current ordering, just make it unpredictable by randomizing.

This is a backport of core#22144

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable