HomePhabricator

[net processing] Dont request compact blocks in blocks-only mode

Description

[net processing] Dont request compact blocks in blocks-only mode

Summary:
A blocks-only node does not participate in transaction relay to reduce its own bandwidth usage and therefore does not have a mempool. The use of compact blocks is not beneficial to such a node since it will always have to download full blocks.

In both high- and low-bandwidth relaying the cmpctblock message is sent. This represent a bandwidth overhead for blocks-only nodes because the cmpctblock message is several times larger in the average case than the equivalent headers or inv announcement.

This PR makes blocks-only nodes always use the legacy relaying to download new blocks. It does so by making blocks-only nodes never initiate a high-bandwidth block relay connection by disabling the sending of sendcmpct(1). Additionally a blocks-only node will never request a compact block using getdata(CMPCT).

A blocks-only node will continue to serve compact blocks to its peers in both high- and low-bandwidth mode.

This is a backport of core#22340
with minor fixes from core#23200 and core#23300

The test is adjusted for Bitcoin ABC: request version 1 compact blocks and expect a single sendcmpct message per block. V1 vs V2 2 compact blocks are specific to Core's segwit support.

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, bytesofman

Reviewed By: #bitcoin_abc, bytesofman

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

Details

Provenance
Niklas Gögge <n.goeggi@gmail.com>Authored on Jun 25 2021, 12:26
PiRKCommitted on Nov 9 2023, 10:04
PiRKPushed on Nov 9 2023, 10:04
Reviewer
Restricted Project
Differential Revision
D14756: [net processing] Dont request compact blocks in blocks-only mode
Parents
rABC7e6681f098c7: [Cashtab] Add function to generate an OP_RETURN output for an airdrop tx
Branches
Unknown
Tags
Unknown