40 static size_t g_num_msg_types{0};
41 return g_num_msg_types;
43 #define FUZZ_TARGET_MSG(msg_type) \
44 struct msg_type##_Count_Before_Main { \
45 msg_type##_Count_Before_Main() \
49 } const static g_##msg_type##_count_before_main; \
50 FUZZ_TARGET_INIT(process_message_##msg_type, initialize_process_message) \
52 fuzz_target(buffer, #msg_type); \
59 static const auto testing_setup = MakeNoLogFileContext<const TestingSetup>(
61 {
"-txreconciliation"});
62 g_setup = testing_setup.get();
81 if (!LIMIT_TO_MESSAGE_TYPE.empty() && random_message_type != LIMIT_TO_MESSAGE_TYPE) {
87 FillNode(fuzzed_data_provider, connman, p2p_node);
89 const auto mock_time =
ConsumeTime(fuzzed_data_provider);
95 g_setup->m_node.peerman->ProcessMessage(p2p_node, random_message_type, random_bytes_data_stream,
96 GetTime<std::chrono::microseconds>(), std::atomic<bool>{
false});
97 }
catch (
const std::ios_base::failure&) {
99 g_setup->m_node.peerman->SendMessages(&p2p_node);
101 g_setup->m_node.connman->StopNodes();
#define Assert(val)
Identity function.
static const std::string REGTEST
Information about a peer.
Serialized script, used inside transaction inputs and outputs.
std::string ConsumeBytesAsString(size_t num_bytes)
std::vector< T > ConsumeRemainingBytes()
static Mutex g_msgproc_mutex
Mutex for anything that is only accessed via the msg processing thread.
A Span is an object that can refer to a contiguous sequence of objects.
constexpr std::size_t size() const noexcept
constexpr C * data() const noexcept
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule)
FUZZ_TARGET_INIT(process_message, initialize_process_message)
#define FUZZ_TARGET_MSG(msg_type)
void fuzz_target(FuzzBufferType buffer, const std::string &LIMIT_TO_MESSAGE_TYPE)
void initialize_process_message()
size_t & GetNumMsgTypes()
const std::vector< std::string > & getAllNetMessageTypes()
void AddTestNode(CNode &node)
void ResetIbd()
Reset the ibd cache to its initial state.
Testing setup that configures a complete environment.
void FillNode(FuzzedDataProvider &fuzzed_data_provider, ConnmanTestMsg &connman, CNode &node) noexcept
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, const std::optional< NodeId > &node_id_in=std::nullopt)
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
CTxIn MineBlock(const NodeContext &node, const CScript &coinbase_scriptPubKey)
Returns the generated coin.
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
void SyncWithValidationInterfaceQueue()
This is a synonym for the following, which asserts certain locks are not held: std::promise<void> pro...
static const int PROTOCOL_VERSION
network protocol versioning