Monero
Loading...
Searching...
No Matches
daemon_messages.h
Go to the documentation of this file.
1// Copyright (c) 2016-2022, The Monero Project
2//
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without modification, are
6// permitted provided that the following conditions are met:
7//
8// 1. Redistributions of source code must retain the above copyright notice, this list of
9// conditions and the following disclaimer.
10//
11// 2. Redistributions in binary form must reproduce the above copyright notice, this list
12// of conditions and the following disclaimer in the documentation and/or other
13// materials provided with the distribution.
14//
15// 3. Neither the name of the copyright holder nor the names of its contributors may be
16// used to endorse or promote products derived from this software without specific
17// prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29#pragma once
30
31#include <rapidjson/writer.h>
32#include <unordered_map>
33#include <vector>
34
35#include "byte_stream.h"
36#include "message.h"
41
42#define BEGIN_RPC_MESSAGE_CLASS(classname) \
43class classname \
44{ \
45 public:
46
47#define BEGIN_RPC_MESSAGE_REQUEST \
48 class Request final : public Message \
49 { \
50 public: \
51 Request() { } \
52 ~Request() { } \
53 void doToJson(rapidjson::Writer<epee::byte_stream>& dest) const override final; \
54 void fromJson(const rapidjson::Value& val) override final;
55
56#define BEGIN_RPC_MESSAGE_RESPONSE \
57 class Response final : public Message \
58 { \
59 public: \
60 Response() { } \
61 ~Response() { } \
62 void doToJson(rapidjson::Writer<epee::byte_stream>& dest) const override final; \
63 void fromJson(const rapidjson::Value& val) override final;
64
65#define END_RPC_MESSAGE_REQUEST };
66#define END_RPC_MESSAGE_RESPONSE };
67#define END_RPC_MESSAGE_CLASS };
68
69// NOTE: when using a type with multiple template parameters,
70// replace any comma in the template specifier with the macro
71// above, or the preprocessor will eat the comma in a bad way.
72#define RPC_MESSAGE_MEMBER(type, name) type name = {}
73
74
75namespace cryptonote
76{
77
78namespace rpc
79{
80
85 RPC_MESSAGE_MEMBER(uint64_t, height);
88
89
92 RPC_MESSAGE_MEMBER(std::list<crypto::hash>, block_ids);
93 RPC_MESSAGE_MEMBER(uint64_t, start_height);
97 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_with_transactions>, blocks);
98 RPC_MESSAGE_MEMBER(uint64_t, start_height);
99 RPC_MESSAGE_MEMBER(uint64_t, current_height);
100 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_output_indices>, output_indices);
103
104
107 RPC_MESSAGE_MEMBER(std::list<crypto::hash>, known_hashes);
108 RPC_MESSAGE_MEMBER(uint64_t, start_height);
111 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, hashes);
112 RPC_MESSAGE_MEMBER(uint64_t, start_height);
113 RPC_MESSAGE_MEMBER(uint64_t, current_height);
116
117
118BEGIN_RPC_MESSAGE_CLASS(GetTransactions);
120 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, tx_hashes);
123 using txes_map = std::unordered_map<crypto::hash, transaction_info>;
125 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, missed_hashes);
128
129
131 enum STATUS {
135 };
137 RPC_MESSAGE_MEMBER(std::vector<crypto::key_image>, key_images);
140 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, spent_status);
143
144
145BEGIN_RPC_MESSAGE_CLASS(GetTxGlobalOutputIndices);
150 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, output_indices);
153
154
155BEGIN_RPC_MESSAGE_CLASS(GetRandomOutputsForAmounts);
157 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
161 RPC_MESSAGE_MEMBER(std::vector<amount_with_random_outputs>, amounts_with_outputs);
164
168 RPC_MESSAGE_MEMBER(bool, relay);
171 RPC_MESSAGE_MEMBER(bool, relayed);
174
177 RPC_MESSAGE_MEMBER(std::string, tx_as_hex);
178 RPC_MESSAGE_MEMBER(bool, relay);
180 using Response = SendRawTx::Response;
182
185 RPC_MESSAGE_MEMBER(std::string, miner_address);
186 RPC_MESSAGE_MEMBER(uint64_t, threads_count);
187 RPC_MESSAGE_MEMBER(bool, do_background_mining);
188 RPC_MESSAGE_MEMBER(bool, ignore_battery);
193
201
208
215 RPC_MESSAGE_MEMBER(uint64_t, threads_count);
217 RPC_MESSAGE_MEMBER(bool, is_background_mining_enabled);
220
227
230 RPC_MESSAGE_MEMBER(uint64_t, height);
236
237BEGIN_RPC_MESSAGE_CLASS(GetBlockTemplate);
243
250
251BEGIN_RPC_MESSAGE_CLASS(GetLastBlockHeader);
258
259BEGIN_RPC_MESSAGE_CLASS(GetBlockHeaderByHash);
267
268BEGIN_RPC_MESSAGE_CLASS(GetBlockHeaderByHeight);
270 RPC_MESSAGE_MEMBER(uint64_t, height);
276
277BEGIN_RPC_MESSAGE_CLASS(GetBlockHeadersByHeight);
279 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, heights);
282 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::BlockHeaderResponse>, headers);
285
292
297 RPC_MESSAGE_MEMBER(std::vector<peer>, white_list);
298 RPC_MESSAGE_MEMBER(std::vector<peer>, gray_list);
301
308
316
317BEGIN_RPC_MESSAGE_CLASS(GetTransactionPool);
321 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::tx_in_pool>, transactions);
325
332
333BEGIN_RPC_MESSAGE_CLASS(GetBlockHeadersRange);
339
346
353
360
369
376
383
384BEGIN_RPC_MESSAGE_CLASS(FlushTransactionPool);
390
391BEGIN_RPC_MESSAGE_CLASS(GetOutputHistogram);
393 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
394 RPC_MESSAGE_MEMBER(uint64_t, min_count);
395 RPC_MESSAGE_MEMBER(uint64_t, max_count);
396 RPC_MESSAGE_MEMBER(bool, unlocked);
397 RPC_MESSAGE_MEMBER(uint64_t, recent_cutoff);
400 RPC_MESSAGE_MEMBER(std::vector<output_amount_count>, histogram);
403
406 RPC_MESSAGE_MEMBER(std::vector<output_amount_and_index>, outputs);
409 RPC_MESSAGE_MEMBER(std::vector<output_key_mask_unlocked>, keys);
412
420
423 RPC_MESSAGE_MEMBER(uint64_t, num_grace_blocks);
426 RPC_MESSAGE_MEMBER(uint64_t, estimated_base_fee);
427 RPC_MESSAGE_MEMBER(uint64_t, fee_mask);
429 RPC_MESSAGE_MEMBER(uint8_t, hard_fork_version);
432
433BEGIN_RPC_MESSAGE_CLASS(GetOutputDistribution);
435 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
436 RPC_MESSAGE_MEMBER(uint64_t, from_height);
437 RPC_MESSAGE_MEMBER(uint64_t, to_height);
438 RPC_MESSAGE_MEMBER(bool, cumulative);
441 RPC_MESSAGE_MEMBER(std::vector<output_distribution>, distributions);
444
445} // namespace rpc
446
447} // namespace cryptonote
static void prune(MDB_env *env0, MDB_env *env1)
Definition: blockchain_prune.cpp:249
Definition: cryptonote_basic.h:205
std::tuple< uint64_t, uint64_t, std::vector< tools::wallet2::transfer_details > > outputs
Definition: cold-outputs.cpp:53
#define BEGIN_RPC_MESSAGE_CLASS(classname)
Definition: daemon_messages.h:42
#define RPC_MESSAGE_MEMBER(type, name)
Definition: daemon_messages.h:72
int * count
Definition: gmock_stress_test.cc:176
epee::byte_slice active
Definition: levin_notify.cpp:255
static MDB_envinfo info
Definition: mdb_load.c:37
static int version
Definition: mdb_load.c:29
uint32_t address
Definition: getifaddr.c:269
Definition: blocks.cpp:13
POD_CLASS hash
Definition: hash.h:48
END_RPC_MESSAGE_CLASS
Definition: daemon_messages.h:87
END_RPC_MESSAGE_REQUEST
Definition: daemon_messages.h:83
BEGIN_RPC_MESSAGE_RESPONSE
Definition: daemon_messages.h:84
SendRawTx::Response Response
Definition: daemon_messages.h:180
BEGIN_RPC_MESSAGE_REQUEST
Definition: daemon_messages.h:82
END_RPC_MESSAGE_RESPONSE
Definition: daemon_messages.h:86
std::unordered_map< crypto::key_image, std::vector< crypto::hash > > key_images_with_tx_hashes
Definition: message_data_structs.h:107
STATUS
Definition: daemon_messages.h:131
@ SPENT_IN_POOL
Definition: daemon_messages.h:134
@ SPENT_IN_BLOCKCHAIN
Definition: daemon_messages.h:133
@ UNSPENT
Definition: daemon_messages.h:132
std::unordered_map< crypto::hash, transaction_info > txes_map
Definition: daemon_messages.h:123
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:45
Definition: speed.py:1
unsigned int uint32_t
Definition: stdint.h:126
unsigned char uint8_t
Definition: stdint.h:124
signed char int8_t
Definition: stdint.h:121
Definition: message_data_structs.h:161
Definition: message_data_structs.h:176
Definition: message_data_structs.h:131
Definition: minissdpd.c:66
struct hash_func hashes[]
cryptonote::transaction tx
Definition: transaction.cpp:40