diff --git a/src/i2p.cpp b/src/i2p.cpp index 04093ea1007f..03513576c459 100644 --- a/src/i2p.cpp +++ b/src/i2p.cpp @@ -285,7 +285,7 @@ std::string Session::Reply::Get(const std::string& key) const const auto& pos = keys.find(key); if (pos == keys.end() || !pos->second.has_value()) { throw std::runtime_error( - strprintf("Missing %s= in the reply to \"%s\": \"%s\"", key, request, full)); + strprintf("Missing %s= in the reply to \"%s\"", key, request)); } return pos->second.value(); } @@ -320,7 +320,7 @@ Session::Reply Session::SendRequestAndGetReply(const Sock& sock, if (check_result_ok && reply.Get("RESULT") != "OK") { throw std::runtime_error( - strprintf("Unexpected reply to \"%s\": \"%s\"", request, reply.full)); + strprintf("Reply to \"%s\": had a RESULT not equal to OK.", reply.request)); } return reply; diff --git a/src/test/fuzz/connman.cpp b/src/test/fuzz/connman.cpp index 1b0859d6ffe4..7ac4f3b8c549 100644 --- a/src/test/fuzz/connman.cpp +++ b/src/test/fuzz/connman.cpp @@ -99,12 +99,14 @@ FUZZ_TARGET(connman, .init = initialize_connman) CNode random_node = ConsumeNode(fuzzed_data_provider); CSubNet random_subnet; std::string random_string; + std::vector node_ids; LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100) { CNode& p2p_node{*ConsumeNodeAsUniquePtr(fuzzed_data_provider).release()}; // Simulate post-handshake state. p2p_node.fSuccessfullyConnected = true; connman.AddTestNode(p2p_node); + node_ids.push_back(p2p_node.GetId()); } LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) { @@ -141,10 +143,15 @@ FUZZ_TARGET(connman, .init = initialize_connman) connman.DisconnectNode(random_subnet); }, [&] { - connman.ForEachNode([](auto) {}); - }, - [&] { - (void)connman.ForNode(fuzzed_data_provider.ConsumeIntegral(), [&](auto) { return fuzzed_data_provider.ConsumeBool(); }); + NodeId id = node_ids.empty() || fuzzed_data_provider.ConsumeBool() + ? fuzzed_data_provider.ConsumeIntegral() + : PickValue(fuzzed_data_provider, node_ids); + (void)connman.ForNode(id, [&](CNode* pnode) { + (void)pnode->GetId(); + (void)pnode->IsInboundConn(); + (void)pnode->IsFullOutboundConn(); + return true; + }); }, [&] { auto max_addresses = fuzzed_data_provider.ConsumeIntegral(); @@ -228,6 +235,12 @@ FUZZ_TARGET(connman, .init = initialize_connman) connman.SocketHandlerPublic(); }); } + connman.ForEachNode([](CNode* pnode) { + (void)pnode->GetId(); + (void)pnode->IsInboundConn(); + (void)pnode->IsFullOutboundConn(); + (void)pnode->ConnectionTypeAsString(); + }); (void)connman.GetAddedNodeInfo(fuzzed_data_provider.ConsumeBool()); (void)connman.GetExtraFullOutboundCount(); (void)connman.GetLocalServices();