HomePhabricator

assumeUTXO: fix peers disconnection during sync

Description

assumeUTXO: fix peers disconnection during sync

Summary:
Because AssumeUTXO nodes prioritize tip synchronization, they relay their local
address through the network before completing the background chain sync.
This, combined with the advertising of full-node service (NODE_NETWORK), can
result in an honest peer in IBD connecting to the AssumeUTXO node (while syncing)
and requesting an historical block the node does not have. This behavior leads to
an abrupt disconnection due to perceived unresponsiveness (lack of response)
from the AssumeUTXO node.

This lack of response occurs because nodes ignore getdata requests when they do
not have the block data available (further discussion can be found in PR 30385).

Fix this by refraining from signaling full-node service support while the
background chain is being synced. During this period, the node will only
signal 'NODE_NETWORK_LIMITED' support. Then, full-node ('NODE_NETWORK')
support will be re-enabled once the background chain sync is completed.

Add coverage for assumeUTXO honest peers disconnection.

Exercising and verifying the following points:

  1. An IBD node can sync headers from an AssumeUTXO node at any time.
  1. IBD nodes do not request historical blocks from AssumeUTXO nodes while they are syncing the background-chain.
  1. The assumeUTXO node dynamically adjusts the network services it offers according to its state.
  1. IBD nodes can fully sync from AssumeUTXO nodes after they finish the background-chain sync.

This is a backport of core#30807 and core#30880

Depends on D17966

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
furszy <matiasfurszyfer@protonmail.com>Authored on Sep 3 2024, 14:00
PiRKCommitted on Wed, Apr 23, 10:42
PiRKPushed on Wed, Apr 23, 10:42
Reviewer
Restricted Project
Differential Revision
D17968: assumeUTXO: fix peers disconnection during sync
Parents
rABC3a7b1c4ac7ec: Work around a bug in clang < 13
Branches
Unknown
Tags
Unknown