mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-28 18:19:31 +01:00
test: add ConnmanTestMsg convenience method Reset()
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -49,6 +49,8 @@ struct ConnmanTestMsg : public CConnman {
|
||||
|
||||
void ResetAddrCache();
|
||||
void ResetMaxOutboundCycle();
|
||||
/// Reset the internal state.
|
||||
void Reset();
|
||||
|
||||
std::vector<CNode*> TestNodes()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user