diff --git a/src/test/fuzz/process_message.cpp b/src/test/fuzz/process_message.cpp index 05a28b2e6f8..d415f216c09 100644 --- a/src/test/fuzz/process_message.cpp +++ b/src/test/fuzz/process_message.cpp @@ -60,6 +60,8 @@ FUZZ_TARGET(process_message, .init = initialize_process_message) FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); auto& connman = static_cast(*g_setup->m_node.connman); + connman.ResetAddrCache(); + connman.ResetMaxOutboundCycle(); auto& chainman = static_cast(*g_setup->m_node.chainman); SetMockTime(1610000000); // any time to successfully reset ibd chainman.ResetIbd(); diff --git a/src/test/fuzz/process_messages.cpp b/src/test/fuzz/process_messages.cpp index 602f588d1c6..941c9b159eb 100644 --- a/src/test/fuzz/process_messages.cpp +++ b/src/test/fuzz/process_messages.cpp @@ -50,6 +50,8 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages) FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); auto& connman = static_cast(*g_setup->m_node.connman); + connman.ResetAddrCache(); + connman.ResetMaxOutboundCycle(); auto& chainman = static_cast(*g_setup->m_node.chainman); SetMockTime(1610000000); // any time to successfully reset ibd chainman.ResetIbd(); diff --git a/src/test/util/net.cpp b/src/test/util/net.cpp index 34d75fa8262..73ae996b7aa 100644 --- a/src/test/util/net.cpp +++ b/src/test/util/net.cpp @@ -71,6 +71,15 @@ void ConnmanTestMsg::Handshake(CNode& node, } } +void ConnmanTestMsg::ResetAddrCache() { m_addr_response_caches = {}; } + +void ConnmanTestMsg::ResetMaxOutboundCycle() +{ + LOCK(m_total_bytes_sent_mutex); + nMaxOutboundCycleStartTime = 0s; + nMaxOutboundTotalBytesSentInCycle = 0; +} + void ConnmanTestMsg::NodeReceiveMsgBytes(CNode& node, std::span msg_bytes, bool& complete) const { assert(node.ReceiveMsgBytes(msg_bytes, complete)); diff --git a/src/test/util/net.h b/src/test/util/net.h index 6bf2bf73007..a938ff1802a 100644 --- a/src/test/util/net.h +++ b/src/test/util/net.h @@ -45,6 +45,9 @@ struct ConnmanTestMsg : public CConnman { m_peer_connect_timeout = timeout; } + void ResetAddrCache(); + void ResetMaxOutboundCycle(); + std::vector TestNodes() { LOCK(m_nodes_mutex);