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