Skip to content

Commit 4cdd1a8

Browse files
fanquakePastaPastaPasta
authored andcommitted
Merge bitcoin#29172: fuzz: set nMaxOutboundLimit in connman target
e5b9ee0 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 e5b9ee0 jonatack: ACK e5b9ee0 Tree-SHA512: d19c83602b0a487e6da0e3be539aa2abc95b8bbf36cf9a3e391a4af53b959f68ca38548a96d27d56742e3b772f648da04e2bf8973dfc0ab1cdabf4f2e8d44de6
1 parent 97012ea commit 4cdd1a8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/fuzz/connman.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
3737
*g_setup->m_node.addrman,
3838
*g_setup->m_node.netgroupman,
3939
fuzzed_data_provider.ConsumeBool()};
40+
41+
const uint64_t max_outbound_limit{fuzzed_data_provider.ConsumeIntegral<uint64_t>()};
42+
connman.Init({ .nMaxOutboundLimit = max_outbound_limit });
43+
4044
CNetAddr random_netaddr;
4145
CNode random_node = ConsumeNode(fuzzed_data_provider);
4246
CSubNet random_subnet;
@@ -120,7 +124,7 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
120124
(void)connman.GetAddedNodeInfo();
121125
(void)connman.GetExtraFullOutboundCount();
122126
(void)connman.GetLocalServices();
123-
(void)connman.GetMaxOutboundTarget();
127+
assert(connman.GetMaxOutboundTarget() == max_outbound_limit);
124128
(void)connman.GetMaxOutboundTimeframe();
125129
(void)connman.GetMaxOutboundTimeLeftInCycle();
126130
(void)connman.GetNetworkActive();

0 commit comments

Comments
 (0)