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>();
60 g_setup = testing_setup.get();
77 if (!LIMIT_TO_MESSAGE_TYPE.empty() && random_message_type != LIMIT_TO_MESSAGE_TYPE) {
82 connman.AddTestNode(p2p_node);
83 FillNode(fuzzed_data_provider, connman, p2p_node);
85 const auto mock_time =
ConsumeTime(fuzzed_data_provider);
91 g_setup->m_node.peerman->ProcessMessage(p2p_node, random_message_type, random_bytes_data_stream,
92 GetTime<std::chrono::microseconds>(), std::atomic<bool>{
false});
93 }
catch (
const std::ios_base::failure&) {
97 g_setup->m_node.peerman->SendMessages(&p2p_node);
100 g_setup->m_node.connman->StopNodes();
void SyncWithValidationInterfaceQueue()
This is a synonym for the following, which asserts certain locks are not held: std::promise<void> pro...
CTxIn MineBlock(const NodeContext &node, const CScript &coinbase_scriptPubKey)
Returns the generated coin.
void initialize_process_message()
constexpr std::size_t size() const noexcept
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule) ...
Double ended buffer combining vector and stream-like interfaces.
void fuzz_target(FuzzBufferType buffer, const std::string &LIMIT_TO_MESSAGE_TYPE)
RecursiveMutex cs_sendProcessing
#define FUZZ_TARGET_MSG(msg_type)
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
void ResetIbd()
Reset the ibd cache to its initial state.
const std::vector< std::string > & getAllNetMessageTypes()
size_t & GetNumMsgTypes()
FUZZ_TARGET_INIT(process_message, initialize_process_message)
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
constexpr C * data() const noexcept
Serialized script, used inside transaction inputs and outputs.
static const int PROTOCOL_VERSION
network protocol versioning
void FillNode(FuzzedDataProvider &fuzzed_data_provider, ConnmanTestMsg &connman, CNode &node) noexcept
A Span is an object that can refer to a contiguous sequence of objects.
Information about a peer.
Testing setup that configures a complete environment.
#define Assert(val)
Identity function.
std::unique_ptr< CNode > ConsumeNodeAsUniquePtr(FuzzedDataProvider &fdp, const std::optional< NodeId > &node_id_in=std::nullopt)