Skip to content

Commit f921d94

Browse files
committed
Merge bitcoin/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
2 parents c2d04f1 + e5b9ee0 commit f921d94

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
@@ -38,6 +38,10 @@ FUZZ_TARGET(connman, .init = initialize_connman)
3838
*g_setup->m_node.netgroupman,
3939
Params(),
4040
fuzzed_data_provider.ConsumeBool()};
41+
42+
const uint64_t max_outbound_limit{fuzzed_data_provider.ConsumeIntegral<uint64_t>()};
43+
connman.Init({ .nMaxOutboundLimit = max_outbound_limit });
44+
4145
CNetAddr random_netaddr;
4246
CNode random_node = ConsumeNode(fuzzed_data_provider);
4347
CSubNet random_subnet;
@@ -125,7 +129,7 @@ FUZZ_TARGET(connman, .init = initialize_connman)
125129
(void)connman.GetAddedNodeInfo(fuzzed_data_provider.ConsumeBool());
126130
(void)connman.GetExtraFullOutboundCount();
127131
(void)connman.GetLocalServices();
128-
(void)connman.GetMaxOutboundTarget();
132+
assert(connman.GetMaxOutboundTarget() == max_outbound_limit);
129133
(void)connman.GetMaxOutboundTimeframe();
130134
(void)connman.GetMaxOutboundTimeLeftInCycle();
131135
(void)connman.GetNetworkActive();

0 commit comments

Comments
 (0)