Page MenuHomePhabricator

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

Authored by PiRK on Nov 8 2023, 16:23.

Details

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

Diff Detail

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