mirror of
https://github.com/wownero/wownero.git
synced 2026-11-12 03:13:54 +01:00
Initialize RPC server state used by direct handler calls, let fuzz input choose restricted or unrestricted mode, and skip iterations when the dummy core fails to initialize. Also update the RPC fuzz harness documentation after removal of the old RPC payment setup.
32 lines
1.2 KiB
C++
32 lines
1.2 KiB
C++
#pragma once
|
|
#include "crypto/hash.h"
|
|
#include "rpc/core_rpc_server.h"
|
|
#include <fuzzer/FuzzedDataProvider.h>
|
|
|
|
// Define templates for dummy protocol object
|
|
template class nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core>>;
|
|
|
|
struct DummyProtocol final : public cryptonote::i_cryptonote_protocol {
|
|
public:
|
|
bool is_synchronized() const;
|
|
bool relay_transactions(cryptonote::NOTIFY_NEW_TRANSACTIONS::request&, const boost::uuids::uuid&, epee::net_utils::zone, cryptonote::relay_method);
|
|
bool relay_block(cryptonote::NOTIFY_NEW_FLUFFY_BLOCK::request&, cryptonote::cryptonote_connection_context&);
|
|
};
|
|
|
|
struct RpcServerBundle {
|
|
std::unique_ptr<cryptonote::t_cryptonote_protocol_handler<cryptonote::core>> proto_handler;
|
|
std::unique_ptr<nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core>>> dummy_p2p;
|
|
std::unique_ptr<cryptonote::core_rpc_server> rpc;
|
|
};
|
|
|
|
struct CoreEnv {
|
|
std::unique_ptr<DummyProtocol> protocol;
|
|
std::unique_ptr<cryptonote::core> core;
|
|
};
|
|
|
|
std::unique_ptr<CoreEnv> initialise_rpc_core();
|
|
std::unique_ptr<RpcServerBundle> initialise_rpc_server(cryptonote::core&, bool);
|
|
bool generate_random_blocks(cryptonote::core&, FuzzedDataProvider&);
|
|
|
|
extern std::vector<crypto::hash> cached_tx_hashes;
|