HomePhabricator

p2p: Make block stalling timeout adaptive

Description

p2p: Make block stalling timeout adaptive

Summary:
This makes the stalling detection mechanism (previously a fixed
timeout of 2s) adaptive:
If we disconnect a peer for stalling, double the timeout for the
next peer - and let it slowly relax back to its default
value each time the tip advances. (Idea by Pieter Wuille)

This makes situations more unlikely in which we'd keep on
disconnecting many of our peers for stalling, even though our
own bandwidth is insufficient to download a block in 2 seconds.

Co-authored-by: Vasil Dimov <vd@FreeBSD.org>

This is a backport of [ core#25880 and core#26982
Note that we need to specify version=4 when calling create_block in the test because we miss core#16333 (which make 4 the default version for create_block)

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Martin Zumsande <mzumsande@gmail.com>Authored on Aug 23 2022, 17:47
PiRKCommitted on Jan 4 2024, 16:51
PiRKPushed on Jan 4 2024, 16:51
Reviewer
Restricted Project
Differential Revision
D15080: p2p: Make block stalling timeout adaptive
Parents
rABCc7433e8fa25f: [Cashtab] Deprecate parsing encrypted msgs in tx history
Branches
Unknown
Tags
Unknown