Monero
message_data_structs.h
Go to the documentation of this file.
1 // Copyright (c) 2016-2018, 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 "crypto/hash.h"
33 #include "ringct/rctSigs.h"
34 
35 #include <unordered_map>
36 #include <vector>
37 
38 namespace cryptonote
39 {
40 
41 namespace rpc
42 {
43 
45  {
47  std::vector<cryptonote::transaction> transactions;
48  };
49 
50  typedef std::vector<uint64_t> tx_output_indices;
51 
52  typedef std::vector<tx_output_indices> block_output_indices;
53 
55  {
57  bool in_pool;
58  uint64_t height;
59  };
60 
62  {
63  uint64_t amount_index;
65  };
66 
67  typedef std::vector<output_key_and_amount_index> outputs_for_amount;
68 
70  {
71  uint64_t amount;
73  };
74 
75  struct peer
76  {
77  uint64_t id;
78  uint32_t ip;
79  uint16_t port;
80  uint64_t last_seen;
81  };
82 
83  struct tx_in_pool
84  {
87  uint64_t blob_size;
88  uint64_t weight;
89  uint64_t fee;
95  uint64_t receive_time;
97  bool relayed;
100  };
101 
102  typedef std::unordered_map<crypto::key_image, std::vector<crypto::hash> > key_images_with_tx_hashes;
103 
105  {
106  uint64_t amount;
107  uint64_t total_count;
108  uint64_t unlocked_count;
109  uint64_t recent_count;
110  };
111 
113  {
114  uint64_t amount;
115  uint64_t index;
116  };
117 
119  {
122  bool unlocked;
123  };
124 
126  {
127  uint8_t version;
128  bool enabled;
129  uint32_t window;
130  uint32_t votes;
131  uint32_t threshold;
132  uint8_t voting;
133  uint32_t state;
134  uint64_t earliest_height;
135  };
136 
137  //required by JSON-RPC 2.0 spec
138  struct error
139  {
140  // not really using code, maybe later.
141  error() : use(false), code(1) { }
142 
143  bool use; // do not serialize
144 
145  int32_t code;
146 
147  // not required by spec, but int error codes aren't perfect
148  std::string error_str;
149 
150  std::string message;
151 
152  //TODO: data member? not required, may want later.
153  };
154 
156  {
157  uint64_t major_version;
158  uint64_t minor_version;
159  uint64_t timestamp;
161  uint32_t nonce;
162  uint64_t height;
163  uint64_t depth;
165  uint64_t difficulty;
166  uint64_t reward;
167  };
168 
169  struct DaemonInfo
170  {
171  uint64_t height;
172  uint64_t target_height;
173  uint64_t difficulty;
174  uint64_t target;
175  uint64_t tx_count;
176  uint64_t tx_pool_size;
182  bool mainnet;
183  bool testnet;
184  bool stagenet;
185  std::string nettype;
192  uint64_t start_time;
193  };
194 
195 } // namespace rpc
196 
197 } // namespace cryptonote
int32_t code
Definition: message_data_structs.h:145
crypto::hash max_used_block_hash
Definition: message_data_structs.h:90
bool in_pool
Definition: message_data_structs.h:57
uint64_t alt_blocks_count
Definition: message_data_structs.h:177
uint16_t port
Definition: message_data_structs.h:79
uint64_t weight
Definition: message_data_structs.h:88
uint64_t block_size_limit
Definition: message_data_structs.h:188
cryptonote::transaction transaction
Definition: message_data_structs.h:56
crypto::hash hash
Definition: message_data_structs.h:164
crypto::hash tx_hash
Definition: message_data_structs.h:86
uint64_t id
Definition: message_data_structs.h:77
std::vector< tx_output_indices > block_output_indices
Definition: message_data_structs.h:52
Definition: message_data_structs.h:69
std::string error_str
Definition: message_data_structs.h:148
rct::key mask
Definition: message_data_structs.h:121
Definition: cryptonote_basic.h:366
uint64_t earliest_height
Definition: message_data_structs.h:134
bool enabled
Definition: message_data_structs.h:128
uint64_t amount
Definition: message_data_structs.h:71
uint64_t amount
Definition: message_data_structs.h:106
uint64_t cumulative_difficulty
Definition: message_data_structs.h:187
uint64_t grey_peerlist_size
Definition: message_data_structs.h:181
uint64_t timestamp
Definition: message_data_structs.h:159
crypto::public_key key
Definition: message_data_structs.h:64
Definition: message_data_structs.h:169
uint64_t height
Definition: message_data_structs.h:58
std::string message
Definition: message_data_structs.h:150
std::vector< uint64_t > tx_output_indices
Definition: message_data_structs.h:50
bool do_not_relay
Definition: message_data_structs.h:98
uint64_t major_version
Definition: message_data_structs.h:157
uint64_t recent_count
Definition: message_data_structs.h:109
cryptonote::transaction tx
Definition: message_data_structs.h:85
std::unordered_map< crypto::key_image, std::vector< crypto::hash > > key_images_with_tx_hashes
Definition: message_data_structs.h:102
Definition: message_data_structs.h:44
bool use
Definition: message_data_structs.h:143
uint64_t index
Definition: message_data_structs.h:115
Definition: message_data_structs.h:155
uint64_t reward
Definition: message_data_structs.h:166
uint64_t last_seen
Definition: message_data_structs.h:80
bool stagenet
Definition: message_data_structs.h:184
uint64_t max_used_block_height
Definition: message_data_structs.h:91
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:224
uint64_t fee
Definition: message_data_structs.h:89
error()
Definition: message_data_structs.h:141
uint64_t depth
Definition: message_data_structs.h:163
Definition: message_data_structs.h:125
uint32_t votes
Definition: message_data_structs.h:130
bool relayed
Definition: message_data_structs.h:97
bool unlocked
Definition: message_data_structs.h:122
uint32_t nonce
Definition: message_data_structs.h:161
uint64_t minor_version
Definition: message_data_structs.h:158
uint64_t last_failed_block_height
Definition: message_data_structs.h:94
uint64_t target
Definition: message_data_structs.h:174
uint64_t blob_size
Definition: message_data_structs.h:87
Definition: rctTypes.h:78
uint8_t voting
Definition: message_data_structs.h:132
bool testnet
Definition: message_data_structs.h:183
Definition: message_data_structs.h:75
uint32_t state
Definition: message_data_structs.h:133
outputs_for_amount outputs
Definition: message_data_structs.h:72
crypto::public_key key
Definition: message_data_structs.h:120
crypto::hash top_block_hash
Definition: message_data_structs.h:186
#define false
Definition: stdbool.h:37
std::vector< output_key_and_amount_index > outputs_for_amount
Definition: message_data_structs.h:67
Definition: message_data_structs.h:112
uint64_t difficulty
Definition: message_data_structs.h:165
Definition: message_data_structs.h:54
POD_CLASS public_key
Definition: crypto.h:63
Definition: message_data_structs.h:104
uint64_t last_relayed_time
Definition: message_data_structs.h:96
uint64_t tx_count
Definition: message_data_structs.h:175
uint32_t threshold
Definition: message_data_structs.h:131
cryptonote::block block
Definition: message_data_structs.h:46
uint64_t amount
Definition: message_data_structs.h:114
uint64_t target_height
Definition: message_data_structs.h:172
uint64_t incoming_connections_count
Definition: message_data_structs.h:179
uint64_t amount_index
Definition: message_data_structs.h:63
bool double_spend_seen
Definition: message_data_structs.h:99
uint64_t tx_pool_size
Definition: message_data_structs.h:176
crypto::hash last_failed_block_hash
Definition: message_data_structs.h:93
uint8_t version
Definition: message_data_structs.h:127
std::string nettype
Definition: message_data_structs.h:185
uint64_t block_size_median
Definition: message_data_structs.h:190
uint64_t unlocked_count
Definition: message_data_structs.h:108
POD_CLASS hash
Definition: hash.h:49
uint64_t outgoing_connections_count
Definition: message_data_structs.h:178
uint64_t start_time
Definition: message_data_structs.h:192
uint64_t height
Definition: message_data_structs.h:162
uint64_t block_weight_median
Definition: message_data_structs.h:191
Definition: message_data_structs.h:138
uint64_t difficulty
Definition: message_data_structs.h:173
uint32_t ip
Definition: message_data_structs.h:78
uint32_t window
Definition: message_data_structs.h:129
Definition: message_data_structs.h:83
uint64_t total_count
Definition: message_data_structs.h:107
Definition: message_data_structs.h:61
uint64_t receive_time
Definition: message_data_structs.h:95
Definition: message_data_structs.h:118
bool kept_by_block
Definition: message_data_structs.h:92
Definition: cryptonote_basic.h:182
uint64_t white_peerlist_size
Definition: message_data_structs.h:180
uint64_t height
Definition: message_data_structs.h:171
bool mainnet
Definition: message_data_structs.h:182
std::vector< cryptonote::transaction > transactions
Definition: message_data_structs.h:47
crypto::hash prev_id
Definition: message_data_structs.h:160
uint64_t block_weight_limit
Definition: message_data_structs.h:189