test: add ConnmanTestMsg convenience method Reset()
This commit is contained in:
4 files changed
+10
-4
No files matched your search
@@ -72,8 +72,7 @@ FUZZ_TARGET(process_message, .init = initialize_process_message)
|
|||||||
|
|
||||||
auto& node{g_setup->m_node};
|
auto& node{g_setup->m_node};
|
||||||
auto& connman{static_cast<ConnmanTestMsg&>(*node.connman)};
|
auto& connman{static_cast<ConnmanTestMsg&>(*node.connman)};
|
||||||
connman.ResetAddrCache();
|
connman.Reset();
|
||||||
connman.ResetMaxOutboundCycle();
|
|
||||||
auto& chainman{static_cast<TestChainstateManager&>(*node.chainman)};
|
auto& chainman{static_cast<TestChainstateManager&>(*node.chainman)};
|
||||||
const auto block_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
|
const auto block_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
|
||||||
SetMockTime(1610000000); // any time to successfully reset ibd
|
SetMockTime(1610000000); // any time to successfully reset ibd
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
|
|||||||
|
|
||||||
auto& node{g_setup->m_node};
|
auto& node{g_setup->m_node};
|
||||||
auto& connman{static_cast<ConnmanTestMsg&>(*node.connman)};
|
auto& connman{static_cast<ConnmanTestMsg&>(*node.connman)};
|
||||||
connman.ResetAddrCache();
|
connman.Reset();
|
||||||
connman.ResetMaxOutboundCycle();
|
|
||||||
auto& chainman{static_cast<TestChainstateManager&>(*node.chainman)};
|
auto& chainman{static_cast<TestChainstateManager&>(*node.chainman)};
|
||||||
const auto block_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
|
const auto block_index_size{WITH_LOCK(chainman.GetMutex(), return chainman.BlockIndex().size())};
|
||||||
SetMockTime(1610000000); // any time to successfully reset ibd
|
SetMockTime(1610000000); // any time to successfully reset ibd
|
||||||
|
|||||||
@@ -80,6 +80,12 @@ void ConnmanTestMsg::ResetMaxOutboundCycle()
|
|||||||
nMaxOutboundTotalBytesSentInCycle = 0;
|
nMaxOutboundTotalBytesSentInCycle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConnmanTestMsg::Reset()
|
||||||
|
{
|
||||||
|
ResetAddrCache();
|
||||||
|
ResetMaxOutboundCycle();
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ struct ConnmanTestMsg : public CConnman {
|
|||||||
|
|
||||||
void ResetAddrCache();
|
void ResetAddrCache();
|
||||||
void ResetMaxOutboundCycle();
|
void ResetMaxOutboundCycle();
|
||||||
|
/// Reset the internal state.
|
||||||
|
void Reset();
|
||||||
|
|
||||||
std::vector<CNode*> TestNodes()
|
std::vector<CNode*> TestNodes()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user