From 8c9a3fd0e87f5855e398a46b482ade4644dc3e92 Mon Sep 17 00:00:00 2001 From: Eugene Siegel Date: Tue, 3 Feb 2026 14:41:50 -0500 Subject: [PATCH] net, fuzz: move CMPCTBLOCK_VERSION to header, use in cmpctblock harness The cmpctblock harness now adds peers and processes the sendcmpct message. --- src/net_processing.cpp | 2 - src/net_processing.h | 2 + src/test/fuzz/cmpctblock.cpp | 82 ++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 28d7d2c13ab..0cee88b4693 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -195,8 +195,6 @@ static constexpr double MAX_ADDR_RATE_PER_SECOND{0.1}; * based increments won't go above this, but the MAX_ADDR_TO_SEND increment following GETADDR * is exempt from this limit). */ static constexpr size_t MAX_ADDR_PROCESSING_TOKEN_BUCKET{MAX_ADDR_TO_SEND}; -/** The compactblocks version we support. See BIP 152. */ -static constexpr uint64_t CMPCTBLOCKS_VERSION{2}; /** For private broadcast, send a transaction to this many peers. */ static constexpr size_t NUM_PRIVATE_BROADCAST_PER_TX{3}; /** Private broadcast connections must complete within this time. Disconnect the peer if it takes longer. */ diff --git a/src/net_processing.h b/src/net_processing.h index d2050d8f3d7..c73f0b14772 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -48,6 +48,8 @@ static const unsigned int MAX_CMPCTBLOCKS_INFLIGHT_PER_BLOCK = 3; /** Number of headers sent in one getheaders result. We rely on the assumption that if a peer sends * less than this number, we reached its tip. Changing this value is a protocol upgrade. */ static const unsigned int MAX_HEADERS_RESULTS = 2000; +/** The compactblocks version we support. See BIP 152. */ +static constexpr uint64_t CMPCTBLOCKS_VERSION{2}; struct CNodeStateStats { int nSyncHeight = -1; diff --git a/src/test/fuzz/cmpctblock.cpp b/src/test/fuzz/cmpctblock.cpp index 7accdb62bf6..31a9d72f4db 100644 --- a/src/test/fuzz/cmpctblock.cpp +++ b/src/test/fuzz/cmpctblock.cpp @@ -2,18 +2,25 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include #include #include #include +#include +#include +#include #include #include #include +#include #include