From 4c68245cf79036b2eba493221d93791b98412448 Mon Sep 17 00:00:00 2001 From: p-j01 Date: Sun, 13 Jun 2021 23:33:42 +0000 Subject: fix: Disconnect stalling peers after timeout of header sync --- src/net_processing.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/net_processing.h') diff --git a/src/net_processing.h b/src/net_processing.h index 9e3f1b715..53ca5e393 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -17,7 +17,10 @@ static const int64_t ORPHAN_TX_EXPIRE_TIME = 20 * 60; static const int64_t ORPHAN_TX_EXPIRE_INTERVAL = 5 * 60; /** Default number of orphan+recently-replaced txn to keep around for block reconstruction */ static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100; - +/** Headers download timeout expressed in microseconds + * Timeout = base + per_header * (expected number of headers) */ +static constexpr int64_t HEADERS_DOWNLOAD_TIMEOUT_BASE = 15 * 60 * 1000000; // 15 minutes +static constexpr int64_t HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER = 1000; // 1ms/header /** Register with a network node to receive its signals */ void RegisterNodeSignals(CNodeSignals& nodeSignals); /** Unregister a network node */ -- cgit v1.2.3