Noticed that include_connected=false path in GetAddedNodeInfo was uncovered was uncovered before this PR and remains so after. Checked coverage against existing corpus, and lines 2976 - 2977 and 2987 - 2988 in net.cpp have not been reached.
Tracing through the code, the gap seems structural, nodes added via AddTestNode get fuzzed CAddress values while AddNode takes arbitrary strings, so mapConnectedByName is never populated relative to m_added_node_params.
If it's worth addressing, I think collecting m_addr_name from test nodes during setup and reusing those names in the AddNode lambda could reach these paths?
<details>
<summary>Suggested fix</summary>
@@ -109,12 +109,14 @@
CSubNet random_subnet;
std::string random_string;
+ std::vector<std::string> node_addr_names;
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100) {
CNode& p2p_node{*ConsumeNodeAsUniquePtr(fuzzed_data_provider).release()};
p2p_node.fSuccessfullyConnected = true;
connman.AddTestNode(p2p_node);
+ node_addr_names.push_back(p2p_node.m_addr_name);
}
@@ -133,14 +135,17 @@
[&] {
+ const std::string& node_str = (!node_addr_names.empty() && fuzzed_data_provider.ConsumeBool())
+ ? PickValue(fuzzed_data_provider, node_addr_names)
+ : random_string;
const auto added_node_info{connman.GetAddedNodeInfo(true)};
- const auto add_node{connman.AddNode({random_string, fuzzed_data_provider.ConsumeBool()})};
+ const auto add_node{connman.AddNode({node_str, fuzzed_data_provider.ConsumeBool()})};
if (add_node) {
- assert(!connman.AddNode({random_string, fuzzed_data_provider.ConsumeBool()}));
+ assert(!connman.AddNode({node_str, fuzzed_data_provider.ConsumeBool()}));
...
- assert(connman.RemoveAddedNode(random_string));
+ assert(connman.RemoveAddedNode(node_str));
...
}
@@ -263,6 +268,7 @@
}
+ (void)connman.GetAddedNodeInfo(false);
(void)connman.GetExtraFullOutboundCount();
</details>
Definitely not a blocker, but might be a solution to a structural coverage gap for this harness?