28 #include <string_view> 33 std::string_view LIMIT_TO_MESSAGE_TYPE{};
38 if (
const auto val{std::getenv(
"LIMIT_TO_MESSAGE_TYPE")}) {
39 LIMIT_TO_MESSAGE_TYPE = val;
43 static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(
45 {.extra_args = {
"-txreconciliation"}});
46 g_setup = testing_setup.get();
50 g_setup->m_node.validation_signals->SyncWithValidationInterfaceQueue();
65 if (!LIMIT_TO_MESSAGE_TYPE.empty() && random_message_type != LIMIT_TO_MESSAGE_TYPE) {
70 connman.AddTestNode(p2p_node);
71 FillNode(fuzzed_data_provider, connman, p2p_node);
73 const auto mock_time =
ConsumeTime(fuzzed_data_provider);
77 net_msg.
m_type = random_message_type;
80 connman.FlushSendBuffer(p2p_node);
81 (void)connman.ReceiveMsgFrom(p2p_node, std::move(net_msg));
87 more_work = connman.ProcessMessagesOnce(p2p_node);
88 }
catch (
const std::ios_base::failure&) {
90 g_setup->m_node.peerman->SendMessages(&p2p_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).
void initialize_process_message()
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) ...
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
FUZZ_TARGET(process_message,.init=initialize_process_message)
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
const std::array ALL_NET_MESSAGE_TYPES
All known message types (see above).
Serialized script, used inside transaction inputs and outputs.
Information about a peer.
Testing setup that configures a complete environment.
#define Assert(val)
Identity function.