HomePhabricator

Randomize message processing peer order

Description

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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D13340

Details

Provenance
Pieter Wuille <pieter@wuille.net>Authored on Jun 2 2021, 20:54
PiRKCommitted on Mar 15 2023, 10:11
PiRKPushed on Mar 15 2023, 10:11
Reviewer
Restricted Project
Differential Revision
D13340: Randomize message processing peer order
Parents
rABC825b7bc9f1f5: Protect last outbound HB compact block peer
Branches
Unknown
Tags
Unknown