|
|
|
@ -296,7 +296,7 @@ inline CAddress ConsumeAddress(FuzzedDataProvider& fuzzed_data_provider) noexcep
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <bool ReturnUniquePtr = false>
|
|
|
|
|
auto ConsumeNode(FuzzedDataProvider& fuzzed_data_provider, const std::optional<NodeId>& node_id_in = nullopt) noexcept
|
|
|
|
|
auto ConsumeNode(FuzzedDataProvider& fuzzed_data_provider, const std::optional<NodeId>& node_id_in = std::nullopt) noexcept
|
|
|
|
|
{
|
|
|
|
|
const NodeId node_id = node_id_in.value_or(fuzzed_data_provider.ConsumeIntegral<NodeId>());
|
|
|
|
|
const ServiceFlags local_services = ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS);
|
|
|
|
@ -316,6 +316,23 @@ auto ConsumeNode(FuzzedDataProvider& fuzzed_data_provider, const std::optional<N
|
|
|
|
|
}
|
|
|
|
|
inline std::unique_ptr<CNode> ConsumeNodeAsUniquePtr(FuzzedDataProvider& fdp, const std::optional<NodeId>& node_id_in = nullopt) { return ConsumeNode<true>(fdp, node_id_in); }
|
|
|
|
|
|
|
|
|
|
inline void FillNode(FuzzedDataProvider& fuzzed_data_provider, CNode& node, const std::optional<int32_t>& version_in = std::nullopt) noexcept
|
|
|
|
|
{
|
|
|
|
|
const ServiceFlags remote_services = ConsumeWeakEnum(fuzzed_data_provider, ALL_SERVICE_FLAGS);
|
|
|
|
|
const NetPermissionFlags permission_flags = ConsumeWeakEnum(fuzzed_data_provider, ALL_NET_PERMISSION_FLAGS);
|
|
|
|
|
const int32_t version = version_in.value_or(fuzzed_data_provider.ConsumeIntegral<int32_t>());
|
|
|
|
|
const bool filter_txs = fuzzed_data_provider.ConsumeBool();
|
|
|
|
|
|
|
|
|
|
node.nServices = remote_services;
|
|
|
|
|
node.m_permissionFlags = permission_flags;
|
|
|
|
|
node.nVersion = version;
|
|
|
|
|
node.SetCommonVersion(version);
|
|
|
|
|
if (node.m_tx_relay != nullptr) {
|
|
|
|
|
LOCK(node.m_tx_relay->cs_filter);
|
|
|
|
|
node.m_tx_relay->fRelayTxes = filter_txs;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void InitializeFuzzingContext(const std::string& chain_name = CBaseChainParams::REGTEST)
|
|
|
|
|
{
|
|
|
|
|
static const BasicTestingSetup basic_testing_setup{chain_name, {"-nodebuglogfile"}};
|
|
|
|
|