Page MenuHomePhabricator

Change transaction request logic to use txrequest
ClosedPublic

Authored by Fabien on May 19 2021, 08:36.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABC984c943817e2: 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

Event Timeline

Fabien requested review of this revision.May 19 2021, 08:36
PiRK added a subscriber: PiRK.
PiRK added inline comments.
src/net_processing.cpp
116

Nit: comment style for multiline comment (newline after /**)

This revision is now accepted and ready to land.May 19 2021, 13:49
Mengerian added a task: Restricted Maniphest Task.May 21 2021, 16:59