HomePhabricator

Change transaction request logic to use txrequest

Description

Change transaction request logic to use txrequest

Summary:

This removes most transaction request logic from net_processing, and
replaces it with calls to a global TxRequestTracker object.

The major changes are:

* Announcements from outbound (and whitelisted) peers are now always
  preferred over those from inbound peers. This used to be the case for
  the first request (by delaying the first request from inbound peers),
  and a bias afters. The 2s delay for requests from inbound peers still
  exists, but after that, if viable outbound peers remain for any given
  transaction, they will always be tried first.
* No more hard cap of 100 in flight transactions per peer, as there is
  less need for it (memory usage is linear in the number of
  announcements, but independent from the number in flight, and CPU
  usage isn't affected by it). Furthermore, if only one peer announces a
  transaction, and it has over 100 in flight and requestable already, we
  still want to request it from them. The cap is replaced with an
  additional 2s delay (possibly combined with the existing 2s delays
  for inbound connections, and for txid peers when wtxid peers are
  available).

Includes functional tests written by Marco Falke and Antoine Riard.

Partial backport of core#19988:
https://github.com/bitcoin/bitcoin/pull/19988/commits/242d16477df1a024c7126bad23dde39cad217eca

Depends on D9549.

Test Plan:

ninja all check-all

With and without the sanitizers:

./test/functional/test_runner.py p2p_tx_download

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

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

Details

Provenance
Pieter Wuille <pieter@wuille.net>Authored on Sep 21 2020, 04:20
FabienCommitted on May 20 2021, 15:13
FabienPushed on May 20 2021, 15:13
Reviewer
Restricted Project
Differential Revision
D9550: Change transaction request logic to use txrequest
Parents
rABCececd2475c1c: Add txrequest fuzz tests
Branches
Unknown
Tags
Unknown