test: add ConnmanTestMsg convenience method Reset()

This commit is contained in:
Vasil Dimov
2026-02-05 09:43:43 +01:00
parent 4ae00e9a71
commit 91b7c874e2
4 changed files with 10 additions and 4 deletions

View File

@@ -72,8 +72,7 @@ FUZZ_TARGET(process_message, .init = initialize_process_message)
auto& node{g_setup->m_node};
auto& connman{static_cast<ConnmanTestMsg&>(*node.connman)};
connman.ResetAddrCache();
connman.ResetMaxOutboundCycle();
connman.Reset();
auto& chainman{static_cast<TestChainstateManager&>(*node.chainman)};
const auto block_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
SetMockTime(1610000000); // any time to successfully reset ibd

View File

@@ -62,8 +62,7 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
auto& node{g_setup->m_node};
auto& connman{static_cast<ConnmanTestMsg&>(*node.connman)};
connman.ResetAddrCache();
connman.ResetMaxOutboundCycle();
connman.Reset();
auto& chainman{static_cast<TestChainstateManager&>(*node.chainman)};
const auto block_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
SetMockTime(1610000000); // any time to successfully reset ibd

View File

@@ -80,6 +80,12 @@ void ConnmanTestMsg::ResetMaxOutboundCycle()
nMaxOutboundTotalBytesSentInCycle = 0;
}
void ConnmanTestMsg::Reset()
{
ResetAddrCache();
ResetMaxOutboundCycle();
}
void ConnmanTestMsg::NodeReceiveMsgBytes(CNode& node, std::span<const uint8_t> msg_bytes, bool& complete) const
{
assert(node.ReceiveMsgBytes(msg_bytes, complete));

View File

@@ -49,6 +49,8 @@ struct ConnmanTestMsg : public CConnman {
void ResetAddrCache();
void ResetMaxOutboundCycle();
/// Reset the internal state.
void Reset();
std::vector<CNode*> TestNodes()
{