fuzz: p2p: Detect peer deadlocks

This commit is contained in:
MarcoFalke 2023-12-06 12:03:56 +01:00
parent 6d5790956f
commit fae1e7e012
No known key found for this signature in database
2 changed files with 13 additions and 6 deletions

View file

@ -78,14 +78,18 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
connman.FlushSendBuffer(random_node);
(void)connman.ReceiveMsgFrom(random_node, std::move(net_msg));
bool more_work{true};
while (more_work) { // Ensure that every message is eventually processed in some way or another
random_node.fPauseSend = false;
try {
connman.ProcessMessagesOnce(random_node);
more_work = connman.ProcessMessagesOnce(random_node);
} catch (const std::ios_base::failure&) {
}
g_setup->m_node.peerman->SendMessages(&random_node);
}
}
SyncWithValidationInterfaceQueue();
g_setup->m_node.connman->StopNodes();
}

View file

@ -70,7 +70,10 @@ struct ConnmanTestMsg : public CConnman {
bool relay_txs)
EXCLUSIVE_LOCKS_REQUIRED(NetEventsInterface::g_msgproc_mutex);
void ProcessMessagesOnce(CNode& node) EXCLUSIVE_LOCKS_REQUIRED(NetEventsInterface::g_msgproc_mutex) { m_msgproc->ProcessMessages(&node, flagInterruptMsgProc); }
bool ProcessMessagesOnce(CNode& node) EXCLUSIVE_LOCKS_REQUIRED(NetEventsInterface::g_msgproc_mutex)
{
return m_msgproc->ProcessMessages(&node, flagInterruptMsgProc);
}
void NodeReceiveMsgBytes(CNode& node, Span<const uint8_t> msg_bytes, bool& complete) const;