mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-25 04:51:05 +02:00
fuzz: Reset dirty connman state in process_message(s) targets
This commit is contained in:
@@ -60,6 +60,8 @@ FUZZ_TARGET(process_message, .init = initialize_process_message)
|
||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||
|
||||
auto& connman = static_cast<ConnmanTestMsg&>(*g_setup->m_node.connman);
|
||||
connman.ResetAddrCache();
|
||||
connman.ResetMaxOutboundCycle();
|
||||
auto& chainman = static_cast<TestChainstateManager&>(*g_setup->m_node.chainman);
|
||||
SetMockTime(1610000000); // any time to successfully reset ibd
|
||||
chainman.ResetIbd();
|
||||
|
@@ -50,6 +50,8 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
|
||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||
|
||||
auto& connman = static_cast<ConnmanTestMsg&>(*g_setup->m_node.connman);
|
||||
connman.ResetAddrCache();
|
||||
connman.ResetMaxOutboundCycle();
|
||||
auto& chainman = static_cast<TestChainstateManager&>(*g_setup->m_node.chainman);
|
||||
SetMockTime(1610000000); // any time to successfully reset ibd
|
||||
chainman.ResetIbd();
|
||||
|
@@ -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<const uint8_t> msg_bytes, bool& complete) const
|
||||
{
|
||||
assert(node.ReceiveMsgBytes(msg_bytes, complete));
|
||||
|
@@ -45,6 +45,9 @@ struct ConnmanTestMsg : public CConnman {
|
||||
m_peer_connect_timeout = timeout;
|
||||
}
|
||||
|
||||
void ResetAddrCache();
|
||||
void ResetMaxOutboundCycle();
|
||||
|
||||
std::vector<CNode*> TestNodes()
|
||||
{
|
||||
LOCK(m_nodes_mutex);
|
||||
|
Reference in New Issue
Block a user