33 static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(
35 {.extra_args = {
"-txreconciliation"}});
36 g_setup = testing_setup.get();
40 g_setup->m_node.validation_signals->SyncWithValidationInterfaceQueue();
54 std::vector<CNode*> peers;
55 const auto num_peers_to_add = fuzzed_data_provider.ConsumeIntegralInRange(1, 3);
56 for (
int i = 0; i < num_peers_to_add; ++i) {
58 CNode& p2p_node = *peers.back();
60 FillNode(fuzzed_data_provider, connman, p2p_node);
62 connman.AddTestNode(p2p_node);
69 const auto mock_time =
ConsumeTime(fuzzed_data_provider);
73 net_msg.
m_type = random_message_type;
78 connman.FlushSendBuffer(random_node);
79 (void)connman.ReceiveMsgFrom(random_node, std::move(net_msg));
86 more_work = connman.ProcessMessagesOnce(random_node);
87 }
catch (
const std::ios_base::failure&) {
89 g_setup->m_node.peerman->SendMessages(&random_node);
92 g_setup->m_node.validation_signals->SyncWithValidationInterfaceQueue();
93 g_setup->m_node.connman->StopNodes();
static Mutex g_msgproc_mutex
Mutex for anything that is only accessed via the msg processing thread.
void FillNode(FuzzedDataProvider &fuzzed_data_provider, ConnmanTestMsg &connman, CNode &node) noexcept
std::atomic_bool fPauseSend
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH
Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable).
std::vector< unsigned char > data
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, const std::optional< NodeId > &node_id_in=std::nullopt)
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule) ...
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
void initialize_process_messages()
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
FUZZ_TARGET(process_messages,.init=initialize_process_messages)
COutPoint MineBlock(const NodeContext &node, const CScript &coinbase_scriptPubKey)
Returns the generated coin.
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
Serialized script, used inside transaction inputs and outputs.
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
Information about a peer.
Testing setup that configures a complete environment.