From 4cdd1a8a5d85d23471d12233840c76f11fbc5eeb Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 9 Jan 2024 09:35:04 +0000 Subject: [PATCH] Merge bitcoin/bitcoin#29172: fuzz: set `nMaxOutboundLimit` in connman target e5b9ee0221ec8aa238fb5720fcd6faa01b09fe46 fuzz: set `nMaxOutboundLimit` in connman target (brunoerg) Pull request description: Setting `nMaxOutboundLimit` (`-maxuploadtarget`) will make fuzz to reach more coverage in connman target. This value is used in `GetMaxOutboundTimeLeftInCycle`, `OutboundTargetReached` and `GetOutboundTargetBytesLeft`. ACKs for top commit: dergoegge: utACK e5b9ee0221ec8aa238fb5720fcd6faa01b09fe46 jonatack: ACK e5b9ee0221ec8aa238fb5720fcd6faa01b09fe46 Tree-SHA512: d19c83602b0a487e6da0e3be539aa2abc95b8bbf36cf9a3e391a4af53b959f68ca38548a96d27d56742e3b772f648da04e2bf8973dfc0ab1cdabf4f2e8d44de6 --- src/test/fuzz/connman.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/fuzz/connman.cpp b/src/test/fuzz/connman.cpp index 54c33843df..fc3fd9201a 100644 --- a/src/test/fuzz/connman.cpp +++ b/src/test/fuzz/connman.cpp @@ -37,6 +37,10 @@ FUZZ_TARGET_INIT(connman, initialize_connman) *g_setup->m_node.addrman, *g_setup->m_node.netgroupman, fuzzed_data_provider.ConsumeBool()}; + + const uint64_t max_outbound_limit{fuzzed_data_provider.ConsumeIntegral()}; + connman.Init({ .nMaxOutboundLimit = max_outbound_limit }); + CNetAddr random_netaddr; CNode random_node = ConsumeNode(fuzzed_data_provider); CSubNet random_subnet; @@ -120,7 +124,7 @@ FUZZ_TARGET_INIT(connman, initialize_connman) (void)connman.GetAddedNodeInfo(); (void)connman.GetExtraFullOutboundCount(); (void)connman.GetLocalServices(); - (void)connman.GetMaxOutboundTarget(); + assert(connman.GetMaxOutboundTarget() == max_outbound_limit); (void)connman.GetMaxOutboundTimeframe(); (void)connman.GetMaxOutboundTimeLeftInCycle(); (void)connman.GetNetworkActive();