| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "string_tools.h" |
| 34 |
|
| 35 |
#include "cryptonote_protocol/cryptonote_protocol_defs.h" |
| 36 |
#include "cryptonote_basic/cryptonote_basic.h" |
| 37 |
#include "cryptonote_basic/difficulty.h" |
| 38 |
#include "crypto/hash.h" |
| 39 |
#include "rpc/rpc_handler.h" |
| 40 |
#include "common/varint.h" |
| 41 |
#include "common/perf_timer.h" |
| 42 |
|
| 43 |
namespace |
| 44 |
{ |
| 45 |
template<typename T> |
| 46 |
std::string compress_integer_array(const std::vector<T> &v) |
| 47 |
{ |
| 48 |
std::string s; |
| 49 |
s.resize(v.size() * (sizeof(T) * 8 / 7 + 1)); |
| 50 |
char *ptr = (char*)s.data(); |
| 51 |
for (const T &t: v) |
| 52 |
tools::write_varint(ptr, t); |
| 53 |
s.resize(ptr - s.data()); |
| 54 |
return s; |
| 55 |
} |
| 56 |
|
| 57 |
template<typename T> |
| 58 |
std::vector<T> decompress_integer_array(const std::string &s) |
| 59 |
{ |
| 60 |
std::vector<T> v; |
| 61 |
v.reserve(s.size()); |
| 62 |
int read = 0; |
| 63 |
const std::string::const_iterator end = s.end(); |
| 64 |
for (std::string::const_iterator i = s.begin(); i != end; std::advance(i, read)) |
| 65 |
{ |
| 66 |
T t; |
| 67 |
read = tools::read_varint(std::string::const_iterator(i), s.end(), t); |
| 68 |
CHECK_AND_ASSERT_THROW_MES(read > 0 && read <= 256, "Error decompressing data"); |
| 69 |
v.push_back(t); |
| 70 |
} |
| 71 |
return v; |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
namespace cryptonote |
| 76 |
{ |
| 77 |
|
| 78 |
#define CORE_RPC_STATUS_OK "OK" |
| 79 |
#define CORE_RPC_STATUS_BUSY "BUSY" |
| 80 |
#define CORE_RPC_STATUS_NOT_MINING "NOT MINING" |
| 81 |
#define CORE_RPC_STATUS_PAYMENT_REQUIRED "PAYMENT REQUIRED" |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
#define CORE_RPC_VERSION_MAJOR 3 |
| 91 |
#define CORE_RPC_VERSION_MINOR 15 |
| 92 |
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor)) |
| 93 |
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR) |
| 94 |
|
| 95 |
struct rpc_request_base |
| 96 |
{ |
| 97 |
BEGIN_KV_SERIALIZE_MAP() |
| 98 |
END_KV_SERIALIZE_MAP() |
| 99 |
}; |
| 100 |
|
| 101 |
struct rpc_response_base |
| 102 |
{ |
| 103 |
std::string status; |
| 104 |
bool untrusted; |
| 105 |
|
| 106 |
rpc_response_base(): untrusted(false) {} |
| 107 |
|
| 108 |
BEGIN_KV_SERIALIZE_MAP() |
| 109 |
KV_SERIALIZE(status) |
| 110 |
KV_SERIALIZE(untrusted) |
| 111 |
END_KV_SERIALIZE_MAP() |
| 112 |
}; |
| 113 |
|
| 114 |
struct rpc_access_request_base: public rpc_request_base |
| 115 |
{ |
| 116 |
std::string client; |
| 117 |
|
| 118 |
BEGIN_KV_SERIALIZE_MAP() |
| 119 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 120 |
KV_SERIALIZE(client) |
| 121 |
END_KV_SERIALIZE_MAP() |
| 122 |
}; |
| 123 |
|
| 124 |
struct rpc_access_response_base: public rpc_response_base |
| 125 |
{ |
| 126 |
uint64_t credits; |
| 127 |
std::string top_hash; |
| 128 |
|
| 129 |
rpc_access_response_base(): credits(0) {} |
| 130 |
|
| 131 |
BEGIN_KV_SERIALIZE_MAP() |
| 132 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 133 |
KV_SERIALIZE(credits) |
| 134 |
KV_SERIALIZE(top_hash) |
| 135 |
END_KV_SERIALIZE_MAP() |
| 136 |
}; |
| 137 |
|
| 138 |
struct COMMAND_RPC_GET_HEIGHT |
| 139 |
{ |
| 140 |
struct request_t: public rpc_request_base |
| 141 |
{ |
| 142 |
BEGIN_KV_SERIALIZE_MAP() |
| 143 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 144 |
END_KV_SERIALIZE_MAP() |
| 145 |
}; |
| 146 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 147 |
|
| 148 |
struct response_t: public rpc_response_base |
| 149 |
{ |
| 150 |
uint64_t height; |
| 151 |
std::string hash; |
| 152 |
|
| 153 |
BEGIN_KV_SERIALIZE_MAP() |
| 154 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 155 |
KV_SERIALIZE(height) |
| 156 |
KV_SERIALIZE(hash) |
| 157 |
END_KV_SERIALIZE_MAP() |
| 158 |
}; |
| 159 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 160 |
}; |
| 161 |
|
| 162 |
struct COMMAND_RPC_GET_BLOCKS_FAST |
| 163 |
{ |
| 164 |
|
| 165 |
enum REQUESTED_INFO |
| 166 |
{ |
| 167 |
BLOCKS_ONLY = 0, |
| 168 |
BLOCKS_AND_POOL = 1, |
| 169 |
POOL_ONLY = 2 |
| 170 |
}; |
| 171 |
|
| 172 |
struct request_t: public rpc_access_request_base |
| 173 |
{ |
| 174 |
uint8_t requested_info; |
| 175 |
std::list<crypto::hash> block_ids; |
| 176 |
uint64_t start_height; |
| 177 |
bool prune; |
| 178 |
bool no_miner_tx; |
| 179 |
uint64_t pool_info_since; |
| 180 |
uint64_t max_block_count; |
| 181 |
|
| 182 |
BEGIN_KV_SERIALIZE_MAP() |
| 183 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 184 |
KV_SERIALIZE_OPT(requested_info, (uint8_t)0) |
| 185 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(block_ids) |
| 186 |
KV_SERIALIZE(start_height) |
| 187 |
KV_SERIALIZE(prune) |
| 188 |
KV_SERIALIZE_OPT(no_miner_tx, false) |
| 189 |
KV_SERIALIZE_OPT(pool_info_since, (uint64_t)0) |
| 190 |
KV_SERIALIZE_OPT(max_block_count, (uint64_t)0) |
| 191 |
END_KV_SERIALIZE_MAP() |
| 192 |
}; |
| 193 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 194 |
|
| 195 |
struct tx_output_indices |
| 196 |
{ |
| 197 |
std::vector<uint64_t> indices; |
| 198 |
|
| 199 |
BEGIN_KV_SERIALIZE_MAP() |
| 200 |
KV_SERIALIZE(indices) |
| 201 |
END_KV_SERIALIZE_MAP() |
| 202 |
}; |
| 203 |
|
| 204 |
struct block_output_indices |
| 205 |
{ |
| 206 |
std::vector<tx_output_indices> indices; |
| 207 |
|
| 208 |
BEGIN_KV_SERIALIZE_MAP() |
| 209 |
KV_SERIALIZE(indices) |
| 210 |
END_KV_SERIALIZE_MAP() |
| 211 |
}; |
| 212 |
|
| 213 |
struct pool_tx_info |
| 214 |
{ |
| 215 |
crypto::hash tx_hash; |
| 216 |
blobdata tx_blob; |
| 217 |
bool double_spend_seen; |
| 218 |
|
| 219 |
BEGIN_KV_SERIALIZE_MAP() |
| 220 |
KV_SERIALIZE_VAL_POD_AS_BLOB(tx_hash) |
| 221 |
KV_SERIALIZE(tx_blob) |
| 222 |
KV_SERIALIZE(double_spend_seen) |
| 223 |
END_KV_SERIALIZE_MAP() |
| 224 |
}; |
| 225 |
|
| 226 |
enum POOL_INFO_EXTENT |
| 227 |
{ |
| 228 |
NONE = 0, |
| 229 |
INCREMENTAL = 1, |
| 230 |
FULL = 2 |
| 231 |
}; |
| 232 |
|
| 233 |
struct response_t: public rpc_access_response_base |
| 234 |
{ |
| 235 |
std::vector<block_complete_entry> blocks; |
| 236 |
uint64_t start_height; |
| 237 |
uint64_t current_height; |
| 238 |
std::vector<block_output_indices> output_indices; |
| 239 |
uint64_t daemon_time; |
| 240 |
uint8_t pool_info_extent; |
| 241 |
std::vector<pool_tx_info> added_pool_txs; |
| 242 |
std::vector<crypto::hash> remaining_added_pool_txids; |
| 243 |
std::vector<crypto::hash> removed_pool_txids; |
| 244 |
|
| 245 |
BEGIN_KV_SERIALIZE_MAP() |
| 246 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 247 |
KV_SERIALIZE(blocks) |
| 248 |
KV_SERIALIZE(start_height) |
| 249 |
KV_SERIALIZE(current_height) |
| 250 |
KV_SERIALIZE(output_indices) |
| 251 |
KV_SERIALIZE_OPT(daemon_time, (uint64_t) 0) |
| 252 |
KV_SERIALIZE_OPT(pool_info_extent, (uint8_t) 0) |
| 253 |
if (pool_info_extent != POOL_INFO_EXTENT::NONE) |
| 254 |
{ |
| 255 |
KV_SERIALIZE(added_pool_txs) |
| 256 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(remaining_added_pool_txids) |
| 257 |
} |
| 258 |
if (pool_info_extent == POOL_INFO_EXTENT::INCREMENTAL) |
| 259 |
{ |
| 260 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(removed_pool_txids) |
| 261 |
} |
| 262 |
END_KV_SERIALIZE_MAP() |
| 263 |
}; |
| 264 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 265 |
}; |
| 266 |
|
| 267 |
struct COMMAND_RPC_GET_BLOCKS_BY_HEIGHT |
| 268 |
{ |
| 269 |
struct request_t: public rpc_access_request_base |
| 270 |
{ |
| 271 |
std::vector<uint64_t> heights; |
| 272 |
BEGIN_KV_SERIALIZE_MAP() |
| 273 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 274 |
KV_SERIALIZE(heights) |
| 275 |
END_KV_SERIALIZE_MAP() |
| 276 |
}; |
| 277 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 278 |
|
| 279 |
struct response_t: public rpc_access_response_base |
| 280 |
{ |
| 281 |
std::vector<block_complete_entry> blocks; |
| 282 |
|
| 283 |
BEGIN_KV_SERIALIZE_MAP() |
| 284 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 285 |
KV_SERIALIZE(blocks) |
| 286 |
END_KV_SERIALIZE_MAP() |
| 287 |
}; |
| 288 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 289 |
}; |
| 290 |
|
| 291 |
struct COMMAND_RPC_GET_ALT_BLOCKS_HASHES |
| 292 |
{ |
| 293 |
struct request_t: public rpc_access_request_base |
| 294 |
{ |
| 295 |
BEGIN_KV_SERIALIZE_MAP() |
| 296 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 297 |
END_KV_SERIALIZE_MAP() |
| 298 |
}; |
| 299 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 300 |
|
| 301 |
struct response_t: public rpc_access_response_base |
| 302 |
{ |
| 303 |
std::vector<std::string> blks_hashes; |
| 304 |
|
| 305 |
BEGIN_KV_SERIALIZE_MAP() |
| 306 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 307 |
KV_SERIALIZE(blks_hashes) |
| 308 |
END_KV_SERIALIZE_MAP() |
| 309 |
}; |
| 310 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 311 |
}; |
| 312 |
struct COMMAND_RPC_GET_HASHES_FAST |
| 313 |
{ |
| 314 |
|
| 315 |
struct request_t: public rpc_access_request_base |
| 316 |
{ |
| 317 |
std::list<crypto::hash> block_ids; |
| 318 |
uint64_t start_height; |
| 319 |
BEGIN_KV_SERIALIZE_MAP() |
| 320 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 321 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(block_ids) |
| 322 |
KV_SERIALIZE(start_height) |
| 323 |
END_KV_SERIALIZE_MAP() |
| 324 |
}; |
| 325 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 326 |
|
| 327 |
struct response_t: public rpc_access_response_base |
| 328 |
{ |
| 329 |
std::vector<crypto::hash> m_block_ids; |
| 330 |
uint64_t start_height; |
| 331 |
uint64_t current_height; |
| 332 |
|
| 333 |
BEGIN_KV_SERIALIZE_MAP() |
| 334 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 335 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_ids) |
| 336 |
KV_SERIALIZE(start_height) |
| 337 |
KV_SERIALIZE(current_height) |
| 338 |
END_KV_SERIALIZE_MAP() |
| 339 |
}; |
| 340 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 341 |
}; |
| 342 |
|
| 343 |
struct COMMAND_RPC_SUBMIT_RAW_TX |
| 344 |
{ |
| 345 |
struct request_t |
| 346 |
{ |
| 347 |
std::string address; |
| 348 |
std::string view_key; |
| 349 |
std::string tx; |
| 350 |
|
| 351 |
BEGIN_KV_SERIALIZE_MAP() |
| 352 |
KV_SERIALIZE(address) |
| 353 |
KV_SERIALIZE(view_key) |
| 354 |
KV_SERIALIZE(tx) |
| 355 |
END_KV_SERIALIZE_MAP() |
| 356 |
}; |
| 357 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 358 |
|
| 359 |
|
| 360 |
struct response_t |
| 361 |
{ |
| 362 |
std::string status; |
| 363 |
std::string error; |
| 364 |
|
| 365 |
BEGIN_KV_SERIALIZE_MAP() |
| 366 |
KV_SERIALIZE(status) |
| 367 |
KV_SERIALIZE(error) |
| 368 |
END_KV_SERIALIZE_MAP() |
| 369 |
}; |
| 370 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 371 |
}; |
| 372 |
|
| 373 |
struct COMMAND_RPC_GET_TRANSACTIONS |
| 374 |
{ |
| 375 |
struct request_t: public rpc_access_request_base |
| 376 |
{ |
| 377 |
std::vector<std::string> txs_hashes; |
| 378 |
bool decode_as_json; |
| 379 |
bool prune; |
| 380 |
bool split; |
| 381 |
|
| 382 |
BEGIN_KV_SERIALIZE_MAP() |
| 383 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 384 |
KV_SERIALIZE(txs_hashes) |
| 385 |
KV_SERIALIZE(decode_as_json) |
| 386 |
KV_SERIALIZE_OPT(prune, false) |
| 387 |
KV_SERIALIZE_OPT(split, false) |
| 388 |
END_KV_SERIALIZE_MAP() |
| 389 |
}; |
| 390 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 391 |
|
| 392 |
struct entry |
| 393 |
{ |
| 394 |
std::string tx_hash; |
| 395 |
std::string as_hex; |
| 396 |
std::string pruned_as_hex; |
| 397 |
std::string prunable_as_hex; |
| 398 |
std::string prunable_hash; |
| 399 |
std::string as_json; |
| 400 |
bool in_pool; |
| 401 |
bool double_spend_seen; |
| 402 |
uint64_t block_height; |
| 403 |
uint64_t confirmations; |
| 404 |
uint64_t block_timestamp; |
| 405 |
uint64_t received_timestamp; |
| 406 |
std::vector<uint64_t> output_indices; |
| 407 |
bool relayed; |
| 408 |
|
| 409 |
BEGIN_KV_SERIALIZE_MAP() |
| 410 |
KV_SERIALIZE(tx_hash) |
| 411 |
KV_SERIALIZE(as_hex) |
| 412 |
KV_SERIALIZE(pruned_as_hex) |
| 413 |
KV_SERIALIZE(prunable_as_hex) |
| 414 |
KV_SERIALIZE(prunable_hash) |
| 415 |
KV_SERIALIZE(as_json) |
| 416 |
KV_SERIALIZE(in_pool) |
| 417 |
KV_SERIALIZE(double_spend_seen) |
| 418 |
if (!this_ref.in_pool) |
| 419 |
{ |
| 420 |
KV_SERIALIZE(block_height) |
| 421 |
KV_SERIALIZE(confirmations) |
| 422 |
KV_SERIALIZE(block_timestamp) |
| 423 |
KV_SERIALIZE(output_indices) |
| 424 |
} |
| 425 |
else |
| 426 |
{ |
| 427 |
KV_SERIALIZE(relayed) |
| 428 |
KV_SERIALIZE(received_timestamp) |
| 429 |
} |
| 430 |
END_KV_SERIALIZE_MAP() |
| 431 |
}; |
| 432 |
|
| 433 |
struct response_t: public rpc_access_response_base |
| 434 |
{ |
| 435 |
|
| 436 |
std::vector<std::string> txs_as_hex; |
| 437 |
std::vector<std::string> txs_as_json; |
| 438 |
|
| 439 |
|
| 440 |
std::vector<std::string> missed_tx; |
| 441 |
|
| 442 |
|
| 443 |
std::vector<entry> txs; |
| 444 |
|
| 445 |
BEGIN_KV_SERIALIZE_MAP() |
| 446 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 447 |
KV_SERIALIZE(txs_as_hex) |
| 448 |
KV_SERIALIZE(txs_as_json) |
| 449 |
KV_SERIALIZE(txs) |
| 450 |
KV_SERIALIZE(missed_tx) |
| 451 |
END_KV_SERIALIZE_MAP() |
| 452 |
}; |
| 453 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 454 |
}; |
| 455 |
|
| 456 |
|
| 457 |
struct COMMAND_RPC_IS_KEY_IMAGE_SPENT |
| 458 |
{ |
| 459 |
enum STATUS { |
| 460 |
UNSPENT = 0, |
| 461 |
SPENT_IN_BLOCKCHAIN = 1, |
| 462 |
SPENT_IN_POOL = 2, |
| 463 |
}; |
| 464 |
|
| 465 |
struct request_t: public rpc_access_request_base |
| 466 |
{ |
| 467 |
std::vector<std::string> key_images; |
| 468 |
|
| 469 |
BEGIN_KV_SERIALIZE_MAP() |
| 470 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 471 |
KV_SERIALIZE(key_images) |
| 472 |
END_KV_SERIALIZE_MAP() |
| 473 |
}; |
| 474 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 475 |
|
| 476 |
|
| 477 |
struct response_t: public rpc_access_response_base |
| 478 |
{ |
| 479 |
std::vector<int> spent_status; |
| 480 |
|
| 481 |
BEGIN_KV_SERIALIZE_MAP() |
| 482 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 483 |
KV_SERIALIZE(spent_status) |
| 484 |
END_KV_SERIALIZE_MAP() |
| 485 |
}; |
| 486 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 487 |
}; |
| 488 |
|
| 489 |
|
| 490 |
struct COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES |
| 491 |
{ |
| 492 |
struct request_t: public rpc_access_request_base |
| 493 |
{ |
| 494 |
crypto::hash txid; |
| 495 |
BEGIN_KV_SERIALIZE_MAP() |
| 496 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 497 |
KV_SERIALIZE_VAL_POD_AS_BLOB(txid) |
| 498 |
END_KV_SERIALIZE_MAP() |
| 499 |
}; |
| 500 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 501 |
|
| 502 |
|
| 503 |
struct response_t: public rpc_access_response_base |
| 504 |
{ |
| 505 |
std::vector<uint64_t> o_indexes; |
| 506 |
|
| 507 |
BEGIN_KV_SERIALIZE_MAP() |
| 508 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 509 |
KV_SERIALIZE(o_indexes) |
| 510 |
END_KV_SERIALIZE_MAP() |
| 511 |
}; |
| 512 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 513 |
}; |
| 514 |
|
| 515 |
struct get_outputs_out |
| 516 |
{ |
| 517 |
uint64_t amount; |
| 518 |
uint64_t index; |
| 519 |
|
| 520 |
BEGIN_KV_SERIALIZE_MAP() |
| 521 |
KV_SERIALIZE(amount) |
| 522 |
KV_SERIALIZE(index) |
| 523 |
END_KV_SERIALIZE_MAP() |
| 524 |
}; |
| 525 |
|
| 526 |
struct COMMAND_RPC_GET_OUTPUTS_BIN |
| 527 |
{ |
| 528 |
struct request_t: public rpc_access_request_base |
| 529 |
{ |
| 530 |
std::vector<get_outputs_out> outputs; |
| 531 |
bool get_txid; |
| 532 |
|
| 533 |
BEGIN_KV_SERIALIZE_MAP() |
| 534 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 535 |
KV_SERIALIZE(outputs) |
| 536 |
KV_SERIALIZE_OPT(get_txid, true) |
| 537 |
END_KV_SERIALIZE_MAP() |
| 538 |
}; |
| 539 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 540 |
|
| 541 |
struct outkey |
| 542 |
{ |
| 543 |
crypto::public_key key; |
| 544 |
rct::key mask; |
| 545 |
bool unlocked; |
| 546 |
uint64_t height; |
| 547 |
crypto::hash txid; |
| 548 |
|
| 549 |
BEGIN_KV_SERIALIZE_MAP() |
| 550 |
KV_SERIALIZE_VAL_POD_AS_BLOB(key) |
| 551 |
KV_SERIALIZE_VAL_POD_AS_BLOB(mask) |
| 552 |
KV_SERIALIZE(unlocked) |
| 553 |
KV_SERIALIZE(height) |
| 554 |
KV_SERIALIZE_VAL_POD_AS_BLOB(txid) |
| 555 |
END_KV_SERIALIZE_MAP() |
| 556 |
}; |
| 557 |
|
| 558 |
struct response_t: public rpc_access_response_base |
| 559 |
{ |
| 560 |
std::vector<outkey> outs; |
| 561 |
|
| 562 |
BEGIN_KV_SERIALIZE_MAP() |
| 563 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 564 |
KV_SERIALIZE(outs) |
| 565 |
END_KV_SERIALIZE_MAP() |
| 566 |
}; |
| 567 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 568 |
}; |
| 569 |
|
| 570 |
struct COMMAND_RPC_GET_OUTPUTS |
| 571 |
{ |
| 572 |
struct request_t: public rpc_access_request_base |
| 573 |
{ |
| 574 |
std::vector<get_outputs_out> outputs; |
| 575 |
bool get_txid; |
| 576 |
|
| 577 |
BEGIN_KV_SERIALIZE_MAP() |
| 578 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 579 |
KV_SERIALIZE(outputs) |
| 580 |
KV_SERIALIZE(get_txid) |
| 581 |
END_KV_SERIALIZE_MAP() |
| 582 |
}; |
| 583 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 584 |
|
| 585 |
struct outkey |
| 586 |
{ |
| 587 |
std::string key; |
| 588 |
std::string mask; |
| 589 |
bool unlocked; |
| 590 |
uint64_t height; |
| 591 |
std::string txid; |
| 592 |
|
| 593 |
BEGIN_KV_SERIALIZE_MAP() |
| 594 |
KV_SERIALIZE(key) |
| 595 |
KV_SERIALIZE(mask) |
| 596 |
KV_SERIALIZE(unlocked) |
| 597 |
KV_SERIALIZE(height) |
| 598 |
KV_SERIALIZE(txid) |
| 599 |
END_KV_SERIALIZE_MAP() |
| 600 |
}; |
| 601 |
|
| 602 |
struct response_t: public rpc_access_response_base |
| 603 |
{ |
| 604 |
std::vector<outkey> outs; |
| 605 |
|
| 606 |
BEGIN_KV_SERIALIZE_MAP() |
| 607 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 608 |
KV_SERIALIZE(outs) |
| 609 |
END_KV_SERIALIZE_MAP() |
| 610 |
}; |
| 611 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 612 |
}; |
| 613 |
|
| 614 |
struct COMMAND_RPC_SEND_RAW_TX |
| 615 |
{ |
| 616 |
struct request_t: public rpc_access_request_base |
| 617 |
{ |
| 618 |
std::string tx_as_hex; |
| 619 |
bool do_not_relay; |
| 620 |
bool do_sanity_checks; |
| 621 |
|
| 622 |
BEGIN_KV_SERIALIZE_MAP() |
| 623 |
KV_SERIALIZE_PARENT(rpc_access_request_base); |
| 624 |
KV_SERIALIZE(tx_as_hex) |
| 625 |
KV_SERIALIZE_OPT(do_not_relay, false) |
| 626 |
KV_SERIALIZE_OPT(do_sanity_checks, true) |
| 627 |
END_KV_SERIALIZE_MAP() |
| 628 |
}; |
| 629 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 630 |
|
| 631 |
|
| 632 |
struct response_t: public rpc_access_response_base |
| 633 |
{ |
| 634 |
std::string reason; |
| 635 |
bool not_relayed; |
| 636 |
bool low_mixin; |
| 637 |
bool double_spend; |
| 638 |
bool invalid_input; |
| 639 |
bool invalid_output; |
| 640 |
bool too_big; |
| 641 |
bool overspend; |
| 642 |
bool fee_too_low; |
| 643 |
bool too_few_outputs; |
| 644 |
bool sanity_check_failed; |
| 645 |
bool tx_extra_too_big; |
| 646 |
bool nonzero_unlock_time; |
| 647 |
|
| 648 |
BEGIN_KV_SERIALIZE_MAP() |
| 649 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 650 |
KV_SERIALIZE(reason) |
| 651 |
KV_SERIALIZE(not_relayed) |
| 652 |
KV_SERIALIZE(low_mixin) |
| 653 |
KV_SERIALIZE(double_spend) |
| 654 |
KV_SERIALIZE(invalid_input) |
| 655 |
KV_SERIALIZE(invalid_output) |
| 656 |
KV_SERIALIZE(too_big) |
| 657 |
KV_SERIALIZE(overspend) |
| 658 |
KV_SERIALIZE(fee_too_low) |
| 659 |
KV_SERIALIZE(too_few_outputs) |
| 660 |
KV_SERIALIZE(sanity_check_failed) |
| 661 |
KV_SERIALIZE(tx_extra_too_big) |
| 662 |
KV_SERIALIZE(nonzero_unlock_time) |
| 663 |
END_KV_SERIALIZE_MAP() |
| 664 |
}; |
| 665 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 666 |
}; |
| 667 |
|
| 668 |
struct COMMAND_RPC_START_MINING |
| 669 |
{ |
| 670 |
struct request_t: public rpc_request_base |
| 671 |
{ |
| 672 |
std::string miner_address; |
| 673 |
uint64_t threads_count; |
| 674 |
bool do_background_mining; |
| 675 |
bool ignore_battery; |
| 676 |
|
| 677 |
BEGIN_KV_SERIALIZE_MAP() |
| 678 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 679 |
KV_SERIALIZE(miner_address) |
| 680 |
KV_SERIALIZE(threads_count) |
| 681 |
KV_SERIALIZE(do_background_mining) |
| 682 |
KV_SERIALIZE(ignore_battery) |
| 683 |
END_KV_SERIALIZE_MAP() |
| 684 |
}; |
| 685 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 686 |
|
| 687 |
struct response_t: public rpc_response_base |
| 688 |
{ |
| 689 |
BEGIN_KV_SERIALIZE_MAP() |
| 690 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 691 |
END_KV_SERIALIZE_MAP() |
| 692 |
}; |
| 693 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 694 |
}; |
| 695 |
|
| 696 |
struct COMMAND_RPC_GET_INFO |
| 697 |
{ |
| 698 |
struct request_t: public rpc_access_request_base |
| 699 |
{ |
| 700 |
BEGIN_KV_SERIALIZE_MAP() |
| 701 |
KV_SERIALIZE_PARENT(rpc_access_request_base); |
| 702 |
END_KV_SERIALIZE_MAP() |
| 703 |
}; |
| 704 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 705 |
|
| 706 |
struct response_t: public rpc_access_response_base |
| 707 |
{ |
| 708 |
uint64_t height; |
| 709 |
uint64_t target_height; |
| 710 |
uint64_t difficulty; |
| 711 |
std::string wide_difficulty; |
| 712 |
uint64_t difficulty_top64; |
| 713 |
uint64_t target; |
| 714 |
uint64_t tx_count; |
| 715 |
uint64_t tx_pool_size; |
| 716 |
uint64_t alt_blocks_count; |
| 717 |
uint64_t outgoing_connections_count; |
| 718 |
uint64_t incoming_connections_count; |
| 719 |
uint64_t rpc_connections_count; |
| 720 |
uint64_t white_peerlist_size; |
| 721 |
uint64_t grey_peerlist_size; |
| 722 |
bool mainnet; |
| 723 |
bool testnet; |
| 724 |
bool stagenet; |
| 725 |
std::string nettype; |
| 726 |
std::string top_block_hash; |
| 727 |
uint64_t cumulative_difficulty; |
| 728 |
std::string wide_cumulative_difficulty; |
| 729 |
uint64_t cumulative_difficulty_top64; |
| 730 |
uint64_t block_size_limit; |
| 731 |
uint64_t block_weight_limit; |
| 732 |
uint64_t block_size_median; |
| 733 |
uint64_t block_weight_median; |
| 734 |
uint64_t adjusted_time; |
| 735 |
uint64_t start_time; |
| 736 |
uint64_t free_space; |
| 737 |
bool offline; |
| 738 |
std::string bootstrap_daemon_address; |
| 739 |
uint64_t height_without_bootstrap; |
| 740 |
bool was_bootstrap_ever_used; |
| 741 |
uint64_t database_size; |
| 742 |
bool update_available; |
| 743 |
bool busy_syncing; |
| 744 |
std::string version; |
| 745 |
bool synchronized; |
| 746 |
bool restricted; |
| 747 |
|
| 748 |
BEGIN_KV_SERIALIZE_MAP() |
| 749 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 750 |
KV_SERIALIZE(height) |
| 751 |
KV_SERIALIZE(target_height) |
| 752 |
KV_SERIALIZE(difficulty) |
| 753 |
KV_SERIALIZE(wide_difficulty) |
| 754 |
KV_SERIALIZE(difficulty_top64) |
| 755 |
KV_SERIALIZE(target) |
| 756 |
KV_SERIALIZE(tx_count) |
| 757 |
KV_SERIALIZE(tx_pool_size) |
| 758 |
KV_SERIALIZE(alt_blocks_count) |
| 759 |
KV_SERIALIZE(outgoing_connections_count) |
| 760 |
KV_SERIALIZE(incoming_connections_count) |
| 761 |
KV_SERIALIZE(rpc_connections_count) |
| 762 |
KV_SERIALIZE(white_peerlist_size) |
| 763 |
KV_SERIALIZE(grey_peerlist_size) |
| 764 |
KV_SERIALIZE(mainnet) |
| 765 |
KV_SERIALIZE(testnet) |
| 766 |
KV_SERIALIZE(stagenet) |
| 767 |
KV_SERIALIZE(nettype) |
| 768 |
KV_SERIALIZE(top_block_hash) |
| 769 |
KV_SERIALIZE(cumulative_difficulty) |
| 770 |
KV_SERIALIZE(wide_cumulative_difficulty) |
| 771 |
KV_SERIALIZE(cumulative_difficulty_top64) |
| 772 |
KV_SERIALIZE(block_size_limit) |
| 773 |
KV_SERIALIZE_OPT(block_weight_limit, (uint64_t)0) |
| 774 |
KV_SERIALIZE(block_size_median) |
| 775 |
KV_SERIALIZE_OPT(block_weight_median, (uint64_t)0) |
| 776 |
KV_SERIALIZE(adjusted_time) |
| 777 |
KV_SERIALIZE(start_time) |
| 778 |
KV_SERIALIZE(free_space) |
| 779 |
KV_SERIALIZE(offline) |
| 780 |
KV_SERIALIZE(bootstrap_daemon_address) |
| 781 |
KV_SERIALIZE(height_without_bootstrap) |
| 782 |
KV_SERIALIZE(was_bootstrap_ever_used) |
| 783 |
KV_SERIALIZE(database_size) |
| 784 |
KV_SERIALIZE(update_available) |
| 785 |
KV_SERIALIZE(busy_syncing) |
| 786 |
KV_SERIALIZE(version) |
| 787 |
KV_SERIALIZE(synchronized) |
| 788 |
KV_SERIALIZE(restricted) |
| 789 |
END_KV_SERIALIZE_MAP() |
| 790 |
}; |
| 791 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 792 |
}; |
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
struct COMMAND_RPC_GET_NET_STATS |
| 797 |
{ |
| 798 |
struct request_t: public rpc_request_base |
| 799 |
{ |
| 800 |
BEGIN_KV_SERIALIZE_MAP() |
| 801 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 802 |
END_KV_SERIALIZE_MAP() |
| 803 |
}; |
| 804 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 805 |
|
| 806 |
|
| 807 |
struct response_t: public rpc_response_base |
| 808 |
{ |
| 809 |
uint64_t start_time; |
| 810 |
uint64_t total_packets_in; |
| 811 |
uint64_t total_bytes_in; |
| 812 |
uint64_t total_packets_out; |
| 813 |
uint64_t total_bytes_out; |
| 814 |
|
| 815 |
BEGIN_KV_SERIALIZE_MAP() |
| 816 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 817 |
KV_SERIALIZE(start_time) |
| 818 |
KV_SERIALIZE(total_packets_in) |
| 819 |
KV_SERIALIZE(total_bytes_in) |
| 820 |
KV_SERIALIZE(total_packets_out) |
| 821 |
KV_SERIALIZE(total_bytes_out) |
| 822 |
END_KV_SERIALIZE_MAP() |
| 823 |
}; |
| 824 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 825 |
}; |
| 826 |
|
| 827 |
|
| 828 |
struct COMMAND_RPC_STOP_MINING |
| 829 |
{ |
| 830 |
struct request_t: public rpc_request_base |
| 831 |
{ |
| 832 |
BEGIN_KV_SERIALIZE_MAP() |
| 833 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 834 |
END_KV_SERIALIZE_MAP() |
| 835 |
}; |
| 836 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 837 |
|
| 838 |
|
| 839 |
struct response_t: public rpc_response_base |
| 840 |
{ |
| 841 |
BEGIN_KV_SERIALIZE_MAP() |
| 842 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 843 |
END_KV_SERIALIZE_MAP() |
| 844 |
}; |
| 845 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 846 |
}; |
| 847 |
|
| 848 |
|
| 849 |
struct COMMAND_RPC_MINING_STATUS |
| 850 |
{ |
| 851 |
struct request_t: public rpc_request_base |
| 852 |
{ |
| 853 |
BEGIN_KV_SERIALIZE_MAP() |
| 854 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 855 |
END_KV_SERIALIZE_MAP() |
| 856 |
}; |
| 857 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 858 |
|
| 859 |
|
| 860 |
struct response_t: public rpc_response_base |
| 861 |
{ |
| 862 |
bool active; |
| 863 |
uint64_t speed; |
| 864 |
uint32_t threads_count; |
| 865 |
std::string address; |
| 866 |
std::string pow_algorithm; |
| 867 |
bool is_background_mining_enabled; |
| 868 |
uint8_t bg_idle_threshold; |
| 869 |
uint8_t bg_min_idle_seconds; |
| 870 |
bool bg_ignore_battery; |
| 871 |
uint8_t bg_target; |
| 872 |
uint32_t block_target; |
| 873 |
uint64_t block_reward; |
| 874 |
uint64_t difficulty; |
| 875 |
std::string wide_difficulty; |
| 876 |
uint64_t difficulty_top64; |
| 877 |
|
| 878 |
BEGIN_KV_SERIALIZE_MAP() |
| 879 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 880 |
KV_SERIALIZE(active) |
| 881 |
KV_SERIALIZE(speed) |
| 882 |
KV_SERIALIZE(threads_count) |
| 883 |
KV_SERIALIZE(address) |
| 884 |
KV_SERIALIZE(pow_algorithm) |
| 885 |
KV_SERIALIZE(is_background_mining_enabled) |
| 886 |
KV_SERIALIZE(bg_idle_threshold) |
| 887 |
KV_SERIALIZE(bg_min_idle_seconds) |
| 888 |
KV_SERIALIZE(bg_ignore_battery) |
| 889 |
KV_SERIALIZE(bg_target) |
| 890 |
KV_SERIALIZE(block_target) |
| 891 |
KV_SERIALIZE(block_reward) |
| 892 |
KV_SERIALIZE(difficulty) |
| 893 |
KV_SERIALIZE(wide_difficulty) |
| 894 |
KV_SERIALIZE(difficulty_top64) |
| 895 |
END_KV_SERIALIZE_MAP() |
| 896 |
}; |
| 897 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 898 |
}; |
| 899 |
|
| 900 |
|
| 901 |
struct COMMAND_RPC_SAVE_BC |
| 902 |
{ |
| 903 |
struct request_t: public rpc_request_base |
| 904 |
{ |
| 905 |
BEGIN_KV_SERIALIZE_MAP() |
| 906 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 907 |
END_KV_SERIALIZE_MAP() |
| 908 |
}; |
| 909 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 910 |
|
| 911 |
|
| 912 |
struct response_t: public rpc_response_base |
| 913 |
{ |
| 914 |
BEGIN_KV_SERIALIZE_MAP() |
| 915 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 916 |
END_KV_SERIALIZE_MAP() |
| 917 |
}; |
| 918 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 919 |
}; |
| 920 |
|
| 921 |
|
| 922 |
struct COMMAND_RPC_GETBLOCKCOUNT |
| 923 |
{ |
| 924 |
typedef std::list<std::string> request; |
| 925 |
|
| 926 |
struct response_t: public rpc_response_base |
| 927 |
{ |
| 928 |
uint64_t count; |
| 929 |
|
| 930 |
BEGIN_KV_SERIALIZE_MAP() |
| 931 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 932 |
KV_SERIALIZE(count) |
| 933 |
END_KV_SERIALIZE_MAP() |
| 934 |
}; |
| 935 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 936 |
}; |
| 937 |
|
| 938 |
struct COMMAND_RPC_GETBLOCKHASH |
| 939 |
{ |
| 940 |
typedef std::vector<uint64_t> request; |
| 941 |
|
| 942 |
typedef std::string response; |
| 943 |
}; |
| 944 |
|
| 945 |
|
| 946 |
struct COMMAND_RPC_GETBLOCKTEMPLATE |
| 947 |
{ |
| 948 |
struct request_t: public rpc_request_base |
| 949 |
{ |
| 950 |
uint64_t reserve_size; |
| 951 |
std::string wallet_address; |
| 952 |
std::string prev_block; |
| 953 |
std::string extra_nonce; |
| 954 |
|
| 955 |
BEGIN_KV_SERIALIZE_MAP() |
| 956 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 957 |
KV_SERIALIZE(reserve_size) |
| 958 |
KV_SERIALIZE(wallet_address) |
| 959 |
KV_SERIALIZE(prev_block) |
| 960 |
KV_SERIALIZE(extra_nonce) |
| 961 |
END_KV_SERIALIZE_MAP() |
| 962 |
}; |
| 963 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 964 |
|
| 965 |
struct response_t: public rpc_response_base |
| 966 |
{ |
| 967 |
uint64_t difficulty; |
| 968 |
std::string wide_difficulty; |
| 969 |
uint64_t difficulty_top64; |
| 970 |
uint64_t height; |
| 971 |
uint64_t reserved_offset; |
| 972 |
uint64_t expected_reward; |
| 973 |
std::string prev_hash; |
| 974 |
uint64_t seed_height; |
| 975 |
std::string seed_hash; |
| 976 |
std::string next_seed_hash; |
| 977 |
blobdata blocktemplate_blob; |
| 978 |
blobdata blockhashing_blob; |
| 979 |
|
| 980 |
BEGIN_KV_SERIALIZE_MAP() |
| 981 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 982 |
KV_SERIALIZE(difficulty) |
| 983 |
KV_SERIALIZE(wide_difficulty) |
| 984 |
KV_SERIALIZE(difficulty_top64) |
| 985 |
KV_SERIALIZE(height) |
| 986 |
KV_SERIALIZE(reserved_offset) |
| 987 |
KV_SERIALIZE(expected_reward) |
| 988 |
KV_SERIALIZE(prev_hash) |
| 989 |
KV_SERIALIZE(seed_height) |
| 990 |
KV_SERIALIZE(blocktemplate_blob) |
| 991 |
KV_SERIALIZE(blockhashing_blob) |
| 992 |
KV_SERIALIZE(seed_hash) |
| 993 |
KV_SERIALIZE(next_seed_hash) |
| 994 |
END_KV_SERIALIZE_MAP() |
| 995 |
}; |
| 996 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 997 |
}; |
| 998 |
|
| 999 |
struct COMMAND_RPC_GETMINERDATA |
| 1000 |
{ |
| 1001 |
struct request_t: public rpc_request_base |
| 1002 |
{ |
| 1003 |
BEGIN_KV_SERIALIZE_MAP() |
| 1004 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1005 |
END_KV_SERIALIZE_MAP() |
| 1006 |
}; |
| 1007 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1008 |
|
| 1009 |
struct response_t: public rpc_response_base |
| 1010 |
{ |
| 1011 |
uint8_t major_version; |
| 1012 |
uint64_t height; |
| 1013 |
std::string prev_id; |
| 1014 |
std::string seed_hash; |
| 1015 |
std::string difficulty; |
| 1016 |
uint64_t median_weight; |
| 1017 |
uint64_t already_generated_coins; |
| 1018 |
|
| 1019 |
struct tx_backlog_entry |
| 1020 |
{ |
| 1021 |
std::string id; |
| 1022 |
uint64_t weight; |
| 1023 |
uint64_t fee; |
| 1024 |
|
| 1025 |
BEGIN_KV_SERIALIZE_MAP() |
| 1026 |
KV_SERIALIZE(id) |
| 1027 |
KV_SERIALIZE(weight) |
| 1028 |
KV_SERIALIZE(fee) |
| 1029 |
END_KV_SERIALIZE_MAP() |
| 1030 |
}; |
| 1031 |
|
| 1032 |
std::vector<tx_backlog_entry> tx_backlog; |
| 1033 |
|
| 1034 |
BEGIN_KV_SERIALIZE_MAP() |
| 1035 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1036 |
KV_SERIALIZE(major_version) |
| 1037 |
KV_SERIALIZE(height) |
| 1038 |
KV_SERIALIZE(prev_id) |
| 1039 |
KV_SERIALIZE(seed_hash) |
| 1040 |
KV_SERIALIZE(difficulty) |
| 1041 |
KV_SERIALIZE(median_weight) |
| 1042 |
KV_SERIALIZE(already_generated_coins) |
| 1043 |
KV_SERIALIZE(tx_backlog) |
| 1044 |
END_KV_SERIALIZE_MAP() |
| 1045 |
}; |
| 1046 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1047 |
}; |
| 1048 |
|
| 1049 |
struct COMMAND_RPC_CALCPOW |
| 1050 |
{ |
| 1051 |
struct request_t: public rpc_request_base |
| 1052 |
{ |
| 1053 |
uint8_t major_version; |
| 1054 |
uint64_t height; |
| 1055 |
blobdata block_blob; |
| 1056 |
std::string seed_hash; |
| 1057 |
|
| 1058 |
BEGIN_KV_SERIALIZE_MAP() |
| 1059 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1060 |
KV_SERIALIZE(major_version) |
| 1061 |
KV_SERIALIZE(height) |
| 1062 |
KV_SERIALIZE(block_blob) |
| 1063 |
KV_SERIALIZE(seed_hash) |
| 1064 |
END_KV_SERIALIZE_MAP() |
| 1065 |
}; |
| 1066 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1067 |
|
| 1068 |
typedef std::string response; |
| 1069 |
}; |
| 1070 |
|
| 1071 |
struct COMMAND_RPC_ADD_AUX_POW |
| 1072 |
{ |
| 1073 |
struct aux_pow_t |
| 1074 |
{ |
| 1075 |
std::string id; |
| 1076 |
std::string hash; |
| 1077 |
|
| 1078 |
BEGIN_KV_SERIALIZE_MAP() |
| 1079 |
KV_SERIALIZE(id) |
| 1080 |
KV_SERIALIZE(hash) |
| 1081 |
END_KV_SERIALIZE_MAP() |
| 1082 |
}; |
| 1083 |
|
| 1084 |
struct request_t: public rpc_request_base |
| 1085 |
{ |
| 1086 |
blobdata blocktemplate_blob; |
| 1087 |
std::vector<aux_pow_t> aux_pow; |
| 1088 |
|
| 1089 |
BEGIN_KV_SERIALIZE_MAP() |
| 1090 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1091 |
KV_SERIALIZE(blocktemplate_blob) |
| 1092 |
KV_SERIALIZE(aux_pow) |
| 1093 |
END_KV_SERIALIZE_MAP() |
| 1094 |
}; |
| 1095 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1096 |
|
| 1097 |
struct response_t: public rpc_response_base |
| 1098 |
{ |
| 1099 |
blobdata blocktemplate_blob; |
| 1100 |
blobdata blockhashing_blob; |
| 1101 |
std::string merkle_root; |
| 1102 |
uint32_t merkle_tree_depth; |
| 1103 |
std::vector<aux_pow_t> aux_pow; |
| 1104 |
|
| 1105 |
BEGIN_KV_SERIALIZE_MAP() |
| 1106 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1107 |
KV_SERIALIZE(blocktemplate_blob) |
| 1108 |
KV_SERIALIZE(blockhashing_blob) |
| 1109 |
KV_SERIALIZE(merkle_root) |
| 1110 |
KV_SERIALIZE(merkle_tree_depth) |
| 1111 |
KV_SERIALIZE(aux_pow) |
| 1112 |
END_KV_SERIALIZE_MAP() |
| 1113 |
}; |
| 1114 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1115 |
}; |
| 1116 |
|
| 1117 |
struct COMMAND_RPC_SUBMITBLOCK |
| 1118 |
{ |
| 1119 |
typedef std::vector<std::string> request; |
| 1120 |
|
| 1121 |
struct response_t: public rpc_response_base |
| 1122 |
{ |
| 1123 |
std::string block_id; |
| 1124 |
|
| 1125 |
BEGIN_KV_SERIALIZE_MAP() |
| 1126 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1127 |
KV_SERIALIZE(block_id) |
| 1128 |
END_KV_SERIALIZE_MAP() |
| 1129 |
}; |
| 1130 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1131 |
}; |
| 1132 |
|
| 1133 |
struct COMMAND_RPC_GENERATEBLOCKS |
| 1134 |
{ |
| 1135 |
struct request_t: public rpc_request_base |
| 1136 |
{ |
| 1137 |
uint64_t amount_of_blocks; |
| 1138 |
std::string wallet_address; |
| 1139 |
std::string prev_block; |
| 1140 |
uint32_t starting_nonce; |
| 1141 |
|
| 1142 |
BEGIN_KV_SERIALIZE_MAP() |
| 1143 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1144 |
KV_SERIALIZE(amount_of_blocks) |
| 1145 |
KV_SERIALIZE(wallet_address) |
| 1146 |
KV_SERIALIZE(prev_block) |
| 1147 |
KV_SERIALIZE_OPT(starting_nonce, (uint32_t)0) |
| 1148 |
END_KV_SERIALIZE_MAP() |
| 1149 |
}; |
| 1150 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1151 |
|
| 1152 |
struct response_t: public rpc_response_base |
| 1153 |
{ |
| 1154 |
uint64_t height; |
| 1155 |
std::vector<std::string> blocks; |
| 1156 |
|
| 1157 |
BEGIN_KV_SERIALIZE_MAP() |
| 1158 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1159 |
KV_SERIALIZE(height) |
| 1160 |
KV_SERIALIZE(blocks) |
| 1161 |
END_KV_SERIALIZE_MAP() |
| 1162 |
}; |
| 1163 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1164 |
}; |
| 1165 |
|
| 1166 |
struct block_header_response |
| 1167 |
{ |
| 1168 |
uint8_t major_version; |
| 1169 |
uint8_t minor_version; |
| 1170 |
uint64_t timestamp; |
| 1171 |
std::string prev_hash; |
| 1172 |
uint32_t nonce; |
| 1173 |
bool orphan_status; |
| 1174 |
uint64_t height; |
| 1175 |
uint64_t depth; |
| 1176 |
std::string hash; |
| 1177 |
uint64_t difficulty; |
| 1178 |
std::string wide_difficulty; |
| 1179 |
uint64_t difficulty_top64; |
| 1180 |
uint64_t cumulative_difficulty; |
| 1181 |
std::string wide_cumulative_difficulty; |
| 1182 |
uint64_t cumulative_difficulty_top64; |
| 1183 |
uint64_t reward; |
| 1184 |
uint64_t block_size; |
| 1185 |
uint64_t block_weight; |
| 1186 |
uint64_t num_txes; |
| 1187 |
std::string pow_hash; |
| 1188 |
uint64_t long_term_weight; |
| 1189 |
std::string miner_tx_hash; |
| 1190 |
|
| 1191 |
BEGIN_KV_SERIALIZE_MAP() |
| 1192 |
KV_SERIALIZE(major_version) |
| 1193 |
KV_SERIALIZE(minor_version) |
| 1194 |
KV_SERIALIZE(timestamp) |
| 1195 |
KV_SERIALIZE(prev_hash) |
| 1196 |
KV_SERIALIZE(nonce) |
| 1197 |
KV_SERIALIZE(orphan_status) |
| 1198 |
KV_SERIALIZE(height) |
| 1199 |
KV_SERIALIZE(depth) |
| 1200 |
KV_SERIALIZE(hash) |
| 1201 |
KV_SERIALIZE(difficulty) |
| 1202 |
KV_SERIALIZE(wide_difficulty) |
| 1203 |
KV_SERIALIZE(difficulty_top64) |
| 1204 |
KV_SERIALIZE(cumulative_difficulty) |
| 1205 |
KV_SERIALIZE(wide_cumulative_difficulty) |
| 1206 |
KV_SERIALIZE(cumulative_difficulty_top64) |
| 1207 |
KV_SERIALIZE(reward) |
| 1208 |
KV_SERIALIZE(block_size) |
| 1209 |
KV_SERIALIZE_OPT(block_weight, (uint64_t)0) |
| 1210 |
KV_SERIALIZE(num_txes) |
| 1211 |
KV_SERIALIZE(pow_hash) |
| 1212 |
KV_SERIALIZE_OPT(long_term_weight, (uint64_t)0) |
| 1213 |
KV_SERIALIZE(miner_tx_hash) |
| 1214 |
END_KV_SERIALIZE_MAP() |
| 1215 |
}; |
| 1216 |
|
| 1217 |
struct COMMAND_RPC_GET_LAST_BLOCK_HEADER |
| 1218 |
{ |
| 1219 |
struct request_t: public rpc_access_request_base |
| 1220 |
{ |
| 1221 |
bool fill_pow_hash; |
| 1222 |
|
| 1223 |
BEGIN_KV_SERIALIZE_MAP() |
| 1224 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1225 |
KV_SERIALIZE_OPT(fill_pow_hash, false); |
| 1226 |
END_KV_SERIALIZE_MAP() |
| 1227 |
}; |
| 1228 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1229 |
|
| 1230 |
struct response_t: public rpc_access_response_base |
| 1231 |
{ |
| 1232 |
block_header_response block_header; |
| 1233 |
|
| 1234 |
BEGIN_KV_SERIALIZE_MAP() |
| 1235 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1236 |
KV_SERIALIZE(block_header) |
| 1237 |
END_KV_SERIALIZE_MAP() |
| 1238 |
}; |
| 1239 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1240 |
|
| 1241 |
}; |
| 1242 |
|
| 1243 |
struct COMMAND_RPC_GET_BLOCK_HEADER_BY_HASH |
| 1244 |
{ |
| 1245 |
struct request_t: public rpc_access_request_base |
| 1246 |
{ |
| 1247 |
std::string hash; |
| 1248 |
std::vector<std::string> hashes; |
| 1249 |
bool fill_pow_hash; |
| 1250 |
|
| 1251 |
BEGIN_KV_SERIALIZE_MAP() |
| 1252 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1253 |
KV_SERIALIZE(hash) |
| 1254 |
KV_SERIALIZE(hashes) |
| 1255 |
KV_SERIALIZE_OPT(fill_pow_hash, false); |
| 1256 |
END_KV_SERIALIZE_MAP() |
| 1257 |
}; |
| 1258 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1259 |
|
| 1260 |
struct response_t: public rpc_access_response_base |
| 1261 |
{ |
| 1262 |
block_header_response block_header; |
| 1263 |
std::vector<block_header_response> block_headers; |
| 1264 |
|
| 1265 |
BEGIN_KV_SERIALIZE_MAP() |
| 1266 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1267 |
KV_SERIALIZE(block_header) |
| 1268 |
KV_SERIALIZE(block_headers) |
| 1269 |
END_KV_SERIALIZE_MAP() |
| 1270 |
}; |
| 1271 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1272 |
}; |
| 1273 |
|
| 1274 |
struct COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT |
| 1275 |
{ |
| 1276 |
struct request_t: public rpc_access_request_base |
| 1277 |
{ |
| 1278 |
uint64_t height; |
| 1279 |
bool fill_pow_hash; |
| 1280 |
|
| 1281 |
BEGIN_KV_SERIALIZE_MAP() |
| 1282 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1283 |
KV_SERIALIZE(height) |
| 1284 |
KV_SERIALIZE_OPT(fill_pow_hash, false); |
| 1285 |
END_KV_SERIALIZE_MAP() |
| 1286 |
}; |
| 1287 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1288 |
|
| 1289 |
struct response_t: public rpc_access_response_base |
| 1290 |
{ |
| 1291 |
block_header_response block_header; |
| 1292 |
|
| 1293 |
BEGIN_KV_SERIALIZE_MAP() |
| 1294 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1295 |
KV_SERIALIZE(block_header) |
| 1296 |
END_KV_SERIALIZE_MAP() |
| 1297 |
}; |
| 1298 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1299 |
}; |
| 1300 |
|
| 1301 |
struct COMMAND_RPC_GET_BLOCK |
| 1302 |
{ |
| 1303 |
struct request_t: public rpc_access_request_base |
| 1304 |
{ |
| 1305 |
std::string hash; |
| 1306 |
uint64_t height; |
| 1307 |
bool fill_pow_hash; |
| 1308 |
|
| 1309 |
BEGIN_KV_SERIALIZE_MAP() |
| 1310 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1311 |
KV_SERIALIZE(hash) |
| 1312 |
KV_SERIALIZE(height) |
| 1313 |
KV_SERIALIZE_OPT(fill_pow_hash, false); |
| 1314 |
END_KV_SERIALIZE_MAP() |
| 1315 |
}; |
| 1316 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1317 |
|
| 1318 |
struct response_t: public rpc_access_response_base |
| 1319 |
{ |
| 1320 |
block_header_response block_header; |
| 1321 |
std::string miner_tx_hash; |
| 1322 |
std::vector<std::string> tx_hashes; |
| 1323 |
std::string blob; |
| 1324 |
std::string json; |
| 1325 |
|
| 1326 |
BEGIN_KV_SERIALIZE_MAP() |
| 1327 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1328 |
KV_SERIALIZE(block_header) |
| 1329 |
KV_SERIALIZE(miner_tx_hash) |
| 1330 |
KV_SERIALIZE(tx_hashes) |
| 1331 |
KV_SERIALIZE(blob) |
| 1332 |
KV_SERIALIZE(json) |
| 1333 |
END_KV_SERIALIZE_MAP() |
| 1334 |
}; |
| 1335 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1336 |
}; |
| 1337 |
|
| 1338 |
struct peer { |
| 1339 |
uint64_t id; |
| 1340 |
std::string host; |
| 1341 |
uint32_t ip; |
| 1342 |
uint16_t port; |
| 1343 |
uint16_t rpc_port; |
| 1344 |
uint32_t rpc_credits_per_hash; |
| 1345 |
uint64_t last_seen; |
| 1346 |
uint32_t pruning_seed; |
| 1347 |
|
| 1348 |
peer() = default; |
| 1349 |
|
| 1350 |
peer(uint64_t id, const std::string &host, uint64_t last_seen, uint32_t pruning_seed, uint16_t rpc_port, uint32_t rpc_credits_per_hash) |
| 1351 |
: id(id), host(host), ip(0), port(0), rpc_port(rpc_port), rpc_credits_per_hash(rpc_credits_per_hash), last_seen(last_seen), pruning_seed(pruning_seed) |
| 1352 |
{} |
| 1353 |
peer(uint64_t id, const std::string &host, uint16_t port, uint64_t last_seen, uint32_t pruning_seed, uint16_t rpc_port, uint32_t rpc_credits_per_hash) |
| 1354 |
: id(id), host(host), ip(0), port(port), rpc_port(rpc_port), rpc_credits_per_hash(rpc_credits_per_hash), last_seen(last_seen), pruning_seed(pruning_seed) |
| 1355 |
{} |
| 1356 |
peer(uint64_t id, uint32_t ip, uint16_t port, uint64_t last_seen, uint32_t pruning_seed, uint16_t rpc_port, uint32_t rpc_credits_per_hash) |
| 1357 |
: id(id), host(epee::string_tools::get_ip_string_from_int32(ip)), ip(ip), port(port), rpc_port(rpc_port), rpc_credits_per_hash(rpc_credits_per_hash), last_seen(last_seen), pruning_seed(pruning_seed) |
| 1358 |
{} |
| 1359 |
|
| 1360 |
BEGIN_KV_SERIALIZE_MAP() |
| 1361 |
KV_SERIALIZE(id) |
| 1362 |
KV_SERIALIZE(host) |
| 1363 |
KV_SERIALIZE(ip) |
| 1364 |
KV_SERIALIZE(port) |
| 1365 |
KV_SERIALIZE_OPT(rpc_port, (uint16_t)0) |
| 1366 |
KV_SERIALIZE_OPT(rpc_credits_per_hash, (uint32_t)0) |
| 1367 |
KV_SERIALIZE(last_seen) |
| 1368 |
KV_SERIALIZE_OPT(pruning_seed, (uint32_t)0) |
| 1369 |
END_KV_SERIALIZE_MAP() |
| 1370 |
}; |
| 1371 |
|
| 1372 |
struct COMMAND_RPC_GET_PEER_LIST |
| 1373 |
{ |
| 1374 |
struct request_t: public rpc_request_base |
| 1375 |
{ |
| 1376 |
bool public_only; |
| 1377 |
bool include_blocked; |
| 1378 |
|
| 1379 |
BEGIN_KV_SERIALIZE_MAP() |
| 1380 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1381 |
KV_SERIALIZE_OPT(public_only, true) |
| 1382 |
KV_SERIALIZE_OPT(include_blocked, false) |
| 1383 |
END_KV_SERIALIZE_MAP() |
| 1384 |
}; |
| 1385 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1386 |
|
| 1387 |
struct response_t: public rpc_response_base |
| 1388 |
{ |
| 1389 |
std::vector<peer> white_list; |
| 1390 |
std::vector<peer> gray_list; |
| 1391 |
|
| 1392 |
BEGIN_KV_SERIALIZE_MAP() |
| 1393 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1394 |
KV_SERIALIZE(white_list) |
| 1395 |
KV_SERIALIZE(gray_list) |
| 1396 |
END_KV_SERIALIZE_MAP() |
| 1397 |
}; |
| 1398 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1399 |
}; |
| 1400 |
|
| 1401 |
struct public_node |
| 1402 |
{ |
| 1403 |
std::string host; |
| 1404 |
uint64_t last_seen; |
| 1405 |
uint16_t rpc_port; |
| 1406 |
uint32_t rpc_credits_per_hash; |
| 1407 |
|
| 1408 |
public_node(): last_seen(0), rpc_port(0), rpc_credits_per_hash(0) {} |
| 1409 |
|
| 1410 |
public_node(const peer &peer) |
| 1411 |
: host(peer.host), last_seen(peer.last_seen), rpc_port(peer.rpc_port), rpc_credits_per_hash(peer.rpc_credits_per_hash) |
| 1412 |
{} |
| 1413 |
|
| 1414 |
BEGIN_KV_SERIALIZE_MAP() |
| 1415 |
KV_SERIALIZE(host) |
| 1416 |
KV_SERIALIZE(last_seen) |
| 1417 |
KV_SERIALIZE(rpc_port) |
| 1418 |
KV_SERIALIZE(rpc_credits_per_hash) |
| 1419 |
END_KV_SERIALIZE_MAP() |
| 1420 |
}; |
| 1421 |
|
| 1422 |
struct COMMAND_RPC_GET_PUBLIC_NODES |
| 1423 |
{ |
| 1424 |
struct request_t: public rpc_request_base |
| 1425 |
{ |
| 1426 |
bool gray; |
| 1427 |
bool white; |
| 1428 |
bool include_blocked; |
| 1429 |
|
| 1430 |
BEGIN_KV_SERIALIZE_MAP() |
| 1431 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1432 |
KV_SERIALIZE_OPT(gray, false) |
| 1433 |
KV_SERIALIZE_OPT(white, true) |
| 1434 |
KV_SERIALIZE_OPT(include_blocked, false) |
| 1435 |
END_KV_SERIALIZE_MAP() |
| 1436 |
}; |
| 1437 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1438 |
|
| 1439 |
struct response_t: public rpc_response_base |
| 1440 |
{ |
| 1441 |
std::vector<public_node> gray; |
| 1442 |
std::vector<public_node> white; |
| 1443 |
|
| 1444 |
BEGIN_KV_SERIALIZE_MAP() |
| 1445 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1446 |
KV_SERIALIZE(gray) |
| 1447 |
KV_SERIALIZE(white) |
| 1448 |
END_KV_SERIALIZE_MAP() |
| 1449 |
}; |
| 1450 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1451 |
}; |
| 1452 |
|
| 1453 |
struct COMMAND_RPC_SET_LOG_HASH_RATE |
| 1454 |
{ |
| 1455 |
struct request_t: public rpc_request_base |
| 1456 |
{ |
| 1457 |
bool visible; |
| 1458 |
|
| 1459 |
BEGIN_KV_SERIALIZE_MAP() |
| 1460 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1461 |
KV_SERIALIZE(visible) |
| 1462 |
END_KV_SERIALIZE_MAP() |
| 1463 |
}; |
| 1464 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1465 |
|
| 1466 |
struct response_t: public rpc_response_base |
| 1467 |
{ |
| 1468 |
BEGIN_KV_SERIALIZE_MAP() |
| 1469 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1470 |
END_KV_SERIALIZE_MAP() |
| 1471 |
}; |
| 1472 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1473 |
}; |
| 1474 |
|
| 1475 |
struct COMMAND_RPC_SET_LOG_LEVEL |
| 1476 |
{ |
| 1477 |
struct request_t: public rpc_request_base |
| 1478 |
{ |
| 1479 |
int8_t level; |
| 1480 |
|
| 1481 |
BEGIN_KV_SERIALIZE_MAP() |
| 1482 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1483 |
KV_SERIALIZE(level) |
| 1484 |
END_KV_SERIALIZE_MAP() |
| 1485 |
}; |
| 1486 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1487 |
|
| 1488 |
struct response_t: public rpc_response_base |
| 1489 |
{ |
| 1490 |
BEGIN_KV_SERIALIZE_MAP() |
| 1491 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1492 |
END_KV_SERIALIZE_MAP() |
| 1493 |
}; |
| 1494 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1495 |
}; |
| 1496 |
|
| 1497 |
struct COMMAND_RPC_SET_LOG_CATEGORIES |
| 1498 |
{ |
| 1499 |
struct request_t: public rpc_request_base |
| 1500 |
{ |
| 1501 |
std::string categories; |
| 1502 |
|
| 1503 |
BEGIN_KV_SERIALIZE_MAP() |
| 1504 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1505 |
KV_SERIALIZE(categories) |
| 1506 |
END_KV_SERIALIZE_MAP() |
| 1507 |
}; |
| 1508 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1509 |
|
| 1510 |
struct response_t: public rpc_response_base |
| 1511 |
{ |
| 1512 |
std::string categories; |
| 1513 |
|
| 1514 |
BEGIN_KV_SERIALIZE_MAP() |
| 1515 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1516 |
KV_SERIALIZE(categories) |
| 1517 |
END_KV_SERIALIZE_MAP() |
| 1518 |
}; |
| 1519 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1520 |
}; |
| 1521 |
|
| 1522 |
struct tx_info |
| 1523 |
{ |
| 1524 |
std::string id_hash; |
| 1525 |
std::string tx_json; |
| 1526 |
uint64_t blob_size; |
| 1527 |
uint64_t weight; |
| 1528 |
uint64_t fee; |
| 1529 |
std::string max_used_block_id_hash; |
| 1530 |
uint64_t max_used_block_height; |
| 1531 |
bool kept_by_block; |
| 1532 |
uint64_t last_failed_height; |
| 1533 |
std::string last_failed_id_hash; |
| 1534 |
uint64_t receive_time; |
| 1535 |
bool relayed; |
| 1536 |
uint64_t last_relayed_time; |
| 1537 |
bool do_not_relay; |
| 1538 |
bool double_spend_seen; |
| 1539 |
std::string tx_blob; |
| 1540 |
|
| 1541 |
BEGIN_KV_SERIALIZE_MAP() |
| 1542 |
KV_SERIALIZE(id_hash) |
| 1543 |
KV_SERIALIZE(tx_json) |
| 1544 |
KV_SERIALIZE(blob_size) |
| 1545 |
KV_SERIALIZE_OPT(weight, (uint64_t)0) |
| 1546 |
KV_SERIALIZE(fee) |
| 1547 |
KV_SERIALIZE(max_used_block_id_hash) |
| 1548 |
KV_SERIALIZE(max_used_block_height) |
| 1549 |
KV_SERIALIZE(kept_by_block) |
| 1550 |
KV_SERIALIZE(last_failed_height) |
| 1551 |
KV_SERIALIZE(last_failed_id_hash) |
| 1552 |
KV_SERIALIZE(receive_time) |
| 1553 |
KV_SERIALIZE(relayed) |
| 1554 |
KV_SERIALIZE(last_relayed_time) |
| 1555 |
KV_SERIALIZE(do_not_relay) |
| 1556 |
KV_SERIALIZE(double_spend_seen) |
| 1557 |
KV_SERIALIZE(tx_blob) |
| 1558 |
END_KV_SERIALIZE_MAP() |
| 1559 |
}; |
| 1560 |
|
| 1561 |
struct spent_key_image_info |
| 1562 |
{ |
| 1563 |
std::string id_hash; |
| 1564 |
std::vector<std::string> txs_hashes; |
| 1565 |
|
| 1566 |
BEGIN_KV_SERIALIZE_MAP() |
| 1567 |
KV_SERIALIZE(id_hash) |
| 1568 |
KV_SERIALIZE(txs_hashes) |
| 1569 |
END_KV_SERIALIZE_MAP() |
| 1570 |
}; |
| 1571 |
|
| 1572 |
struct COMMAND_RPC_GET_TRANSACTION_POOL |
| 1573 |
{ |
| 1574 |
struct request_t: public rpc_access_request_base |
| 1575 |
{ |
| 1576 |
BEGIN_KV_SERIALIZE_MAP() |
| 1577 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1578 |
END_KV_SERIALIZE_MAP() |
| 1579 |
}; |
| 1580 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1581 |
|
| 1582 |
struct response_t: public rpc_access_response_base |
| 1583 |
{ |
| 1584 |
std::vector<tx_info> transactions; |
| 1585 |
std::vector<spent_key_image_info> spent_key_images; |
| 1586 |
|
| 1587 |
BEGIN_KV_SERIALIZE_MAP() |
| 1588 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1589 |
KV_SERIALIZE(transactions) |
| 1590 |
KV_SERIALIZE(spent_key_images) |
| 1591 |
END_KV_SERIALIZE_MAP() |
| 1592 |
}; |
| 1593 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1594 |
}; |
| 1595 |
|
| 1596 |
struct COMMAND_RPC_GET_TRANSACTION_POOL_HASHES_BIN |
| 1597 |
{ |
| 1598 |
struct request_t: public rpc_access_request_base |
| 1599 |
{ |
| 1600 |
BEGIN_KV_SERIALIZE_MAP() |
| 1601 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1602 |
END_KV_SERIALIZE_MAP() |
| 1603 |
}; |
| 1604 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1605 |
|
| 1606 |
struct response_t: public rpc_access_response_base |
| 1607 |
{ |
| 1608 |
std::vector<crypto::hash> tx_hashes; |
| 1609 |
|
| 1610 |
BEGIN_KV_SERIALIZE_MAP() |
| 1611 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1612 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(tx_hashes) |
| 1613 |
END_KV_SERIALIZE_MAP() |
| 1614 |
}; |
| 1615 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1616 |
}; |
| 1617 |
|
| 1618 |
struct COMMAND_RPC_GET_TRANSACTION_POOL_HASHES |
| 1619 |
{ |
| 1620 |
struct request_t: public rpc_access_request_base |
| 1621 |
{ |
| 1622 |
BEGIN_KV_SERIALIZE_MAP() |
| 1623 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1624 |
END_KV_SERIALIZE_MAP() |
| 1625 |
}; |
| 1626 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1627 |
|
| 1628 |
struct response_t: public rpc_access_response_base |
| 1629 |
{ |
| 1630 |
std::vector<std::string> tx_hashes; |
| 1631 |
|
| 1632 |
BEGIN_KV_SERIALIZE_MAP() |
| 1633 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1634 |
KV_SERIALIZE(tx_hashes) |
| 1635 |
END_KV_SERIALIZE_MAP() |
| 1636 |
}; |
| 1637 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1638 |
}; |
| 1639 |
|
| 1640 |
struct tx_backlog_entry |
| 1641 |
{ |
| 1642 |
uint64_t weight; |
| 1643 |
uint64_t fee; |
| 1644 |
uint64_t time_in_pool; |
| 1645 |
}; |
| 1646 |
|
| 1647 |
struct COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG |
| 1648 |
{ |
| 1649 |
struct request_t: public rpc_access_request_base |
| 1650 |
{ |
| 1651 |
BEGIN_KV_SERIALIZE_MAP() |
| 1652 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1653 |
END_KV_SERIALIZE_MAP() |
| 1654 |
}; |
| 1655 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1656 |
|
| 1657 |
struct response_t: public rpc_access_response_base |
| 1658 |
{ |
| 1659 |
std::vector<tx_backlog_entry> backlog; |
| 1660 |
|
| 1661 |
BEGIN_KV_SERIALIZE_MAP() |
| 1662 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1663 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(backlog) |
| 1664 |
END_KV_SERIALIZE_MAP() |
| 1665 |
}; |
| 1666 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1667 |
}; |
| 1668 |
|
| 1669 |
struct txpool_histo |
| 1670 |
{ |
| 1671 |
uint32_t txs; |
| 1672 |
uint64_t bytes; |
| 1673 |
|
| 1674 |
BEGIN_KV_SERIALIZE_MAP() |
| 1675 |
KV_SERIALIZE(txs) |
| 1676 |
KV_SERIALIZE(bytes) |
| 1677 |
END_KV_SERIALIZE_MAP() |
| 1678 |
}; |
| 1679 |
|
| 1680 |
struct txpool_stats |
| 1681 |
{ |
| 1682 |
uint64_t bytes_total; |
| 1683 |
uint32_t bytes_min; |
| 1684 |
uint32_t bytes_max; |
| 1685 |
uint32_t bytes_med; |
| 1686 |
uint64_t fee_total; |
| 1687 |
uint64_t oldest; |
| 1688 |
uint32_t txs_total; |
| 1689 |
uint32_t num_failing; |
| 1690 |
uint32_t num_10m; |
| 1691 |
uint32_t num_not_relayed; |
| 1692 |
uint64_t histo_98pc; |
| 1693 |
std::vector<txpool_histo> histo; |
| 1694 |
uint32_t num_double_spends; |
| 1695 |
|
| 1696 |
txpool_stats(): bytes_total(0), bytes_min(0), bytes_max(0), bytes_med(0), fee_total(0), oldest(0), txs_total(0), num_failing(0), num_10m(0), num_not_relayed(0), histo_98pc(0), num_double_spends(0) {} |
| 1697 |
|
| 1698 |
BEGIN_KV_SERIALIZE_MAP() |
| 1699 |
KV_SERIALIZE(bytes_total) |
| 1700 |
KV_SERIALIZE(bytes_min) |
| 1701 |
KV_SERIALIZE(bytes_max) |
| 1702 |
KV_SERIALIZE(bytes_med) |
| 1703 |
KV_SERIALIZE(fee_total) |
| 1704 |
KV_SERIALIZE(oldest) |
| 1705 |
KV_SERIALIZE(txs_total) |
| 1706 |
KV_SERIALIZE(num_failing) |
| 1707 |
KV_SERIALIZE(num_10m) |
| 1708 |
KV_SERIALIZE(num_not_relayed) |
| 1709 |
KV_SERIALIZE(histo_98pc) |
| 1710 |
KV_SERIALIZE(histo) |
| 1711 |
KV_SERIALIZE(num_double_spends) |
| 1712 |
END_KV_SERIALIZE_MAP() |
| 1713 |
}; |
| 1714 |
|
| 1715 |
struct COMMAND_RPC_GET_TRANSACTION_POOL_STATS |
| 1716 |
{ |
| 1717 |
struct request_t: public rpc_access_request_base |
| 1718 |
{ |
| 1719 |
BEGIN_KV_SERIALIZE_MAP() |
| 1720 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1721 |
END_KV_SERIALIZE_MAP() |
| 1722 |
}; |
| 1723 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1724 |
|
| 1725 |
struct response_t: public rpc_access_response_base |
| 1726 |
{ |
| 1727 |
txpool_stats pool_stats; |
| 1728 |
|
| 1729 |
BEGIN_KV_SERIALIZE_MAP() |
| 1730 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1731 |
KV_SERIALIZE(pool_stats) |
| 1732 |
END_KV_SERIALIZE_MAP() |
| 1733 |
}; |
| 1734 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1735 |
}; |
| 1736 |
|
| 1737 |
struct COMMAND_RPC_GET_CONNECTIONS |
| 1738 |
{ |
| 1739 |
struct request_t: public rpc_request_base |
| 1740 |
{ |
| 1741 |
BEGIN_KV_SERIALIZE_MAP() |
| 1742 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1743 |
END_KV_SERIALIZE_MAP() |
| 1744 |
}; |
| 1745 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1746 |
|
| 1747 |
struct response_t: public rpc_response_base |
| 1748 |
{ |
| 1749 |
std::list<connection_info> connections; |
| 1750 |
|
| 1751 |
BEGIN_KV_SERIALIZE_MAP() |
| 1752 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1753 |
KV_SERIALIZE(connections) |
| 1754 |
END_KV_SERIALIZE_MAP() |
| 1755 |
}; |
| 1756 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1757 |
}; |
| 1758 |
|
| 1759 |
struct COMMAND_RPC_GET_BLOCK_HEADERS_RANGE |
| 1760 |
{ |
| 1761 |
struct request_t: public rpc_access_request_base |
| 1762 |
{ |
| 1763 |
uint64_t start_height; |
| 1764 |
uint64_t end_height; |
| 1765 |
bool fill_pow_hash; |
| 1766 |
|
| 1767 |
BEGIN_KV_SERIALIZE_MAP() |
| 1768 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1769 |
KV_SERIALIZE(start_height) |
| 1770 |
KV_SERIALIZE(end_height) |
| 1771 |
KV_SERIALIZE_OPT(fill_pow_hash, false); |
| 1772 |
END_KV_SERIALIZE_MAP() |
| 1773 |
}; |
| 1774 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1775 |
|
| 1776 |
struct response_t: public rpc_access_response_base |
| 1777 |
{ |
| 1778 |
std::vector<block_header_response> headers; |
| 1779 |
|
| 1780 |
BEGIN_KV_SERIALIZE_MAP() |
| 1781 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1782 |
KV_SERIALIZE(headers) |
| 1783 |
END_KV_SERIALIZE_MAP() |
| 1784 |
}; |
| 1785 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1786 |
}; |
| 1787 |
|
| 1788 |
struct COMMAND_RPC_SET_BOOTSTRAP_DAEMON |
| 1789 |
{ |
| 1790 |
struct request_t |
| 1791 |
{ |
| 1792 |
std::string address; |
| 1793 |
std::string username; |
| 1794 |
std::string password; |
| 1795 |
std::string proxy; |
| 1796 |
|
| 1797 |
BEGIN_KV_SERIALIZE_MAP() |
| 1798 |
KV_SERIALIZE(address) |
| 1799 |
KV_SERIALIZE(username) |
| 1800 |
KV_SERIALIZE(password) |
| 1801 |
KV_SERIALIZE(proxy) |
| 1802 |
END_KV_SERIALIZE_MAP() |
| 1803 |
}; |
| 1804 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1805 |
|
| 1806 |
struct response_t |
| 1807 |
{ |
| 1808 |
std::string status; |
| 1809 |
|
| 1810 |
BEGIN_KV_SERIALIZE_MAP() |
| 1811 |
KV_SERIALIZE(status) |
| 1812 |
END_KV_SERIALIZE_MAP() |
| 1813 |
}; |
| 1814 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1815 |
}; |
| 1816 |
|
| 1817 |
struct COMMAND_RPC_STOP_DAEMON |
| 1818 |
{ |
| 1819 |
struct request_t: public rpc_request_base |
| 1820 |
{ |
| 1821 |
BEGIN_KV_SERIALIZE_MAP() |
| 1822 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1823 |
END_KV_SERIALIZE_MAP() |
| 1824 |
}; |
| 1825 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1826 |
|
| 1827 |
struct response_t: public rpc_response_base |
| 1828 |
{ |
| 1829 |
BEGIN_KV_SERIALIZE_MAP() |
| 1830 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1831 |
END_KV_SERIALIZE_MAP() |
| 1832 |
}; |
| 1833 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1834 |
}; |
| 1835 |
|
| 1836 |
struct COMMAND_RPC_FAST_EXIT |
| 1837 |
{ |
| 1838 |
struct request_t: public rpc_request_base |
| 1839 |
{ |
| 1840 |
BEGIN_KV_SERIALIZE_MAP() |
| 1841 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1842 |
END_KV_SERIALIZE_MAP() |
| 1843 |
}; |
| 1844 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1845 |
|
| 1846 |
struct response_t: public rpc_response_base |
| 1847 |
{ |
| 1848 |
BEGIN_KV_SERIALIZE_MAP() |
| 1849 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1850 |
END_KV_SERIALIZE_MAP() |
| 1851 |
}; |
| 1852 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1853 |
}; |
| 1854 |
|
| 1855 |
struct COMMAND_RPC_GET_LIMIT |
| 1856 |
{ |
| 1857 |
struct request_t: public rpc_request_base |
| 1858 |
{ |
| 1859 |
BEGIN_KV_SERIALIZE_MAP() |
| 1860 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1861 |
END_KV_SERIALIZE_MAP() |
| 1862 |
}; |
| 1863 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1864 |
|
| 1865 |
struct response_t: public rpc_response_base |
| 1866 |
{ |
| 1867 |
uint64_t limit_up; |
| 1868 |
uint64_t limit_down; |
| 1869 |
|
| 1870 |
BEGIN_KV_SERIALIZE_MAP() |
| 1871 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1872 |
KV_SERIALIZE(limit_up) |
| 1873 |
KV_SERIALIZE(limit_down) |
| 1874 |
END_KV_SERIALIZE_MAP() |
| 1875 |
}; |
| 1876 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1877 |
}; |
| 1878 |
|
| 1879 |
struct COMMAND_RPC_SET_LIMIT |
| 1880 |
{ |
| 1881 |
struct request_t: public rpc_request_base |
| 1882 |
{ |
| 1883 |
int64_t limit_down; |
| 1884 |
int64_t limit_up; |
| 1885 |
|
| 1886 |
BEGIN_KV_SERIALIZE_MAP() |
| 1887 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1888 |
KV_SERIALIZE(limit_down) |
| 1889 |
KV_SERIALIZE(limit_up) |
| 1890 |
END_KV_SERIALIZE_MAP() |
| 1891 |
}; |
| 1892 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1893 |
|
| 1894 |
struct response_t: public rpc_response_base |
| 1895 |
{ |
| 1896 |
int64_t limit_up; |
| 1897 |
int64_t limit_down; |
| 1898 |
|
| 1899 |
BEGIN_KV_SERIALIZE_MAP() |
| 1900 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1901 |
KV_SERIALIZE(limit_up) |
| 1902 |
KV_SERIALIZE(limit_down) |
| 1903 |
END_KV_SERIALIZE_MAP() |
| 1904 |
}; |
| 1905 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1906 |
}; |
| 1907 |
|
| 1908 |
struct COMMAND_RPC_OUT_PEERS |
| 1909 |
{ |
| 1910 |
struct request_t: public rpc_request_base |
| 1911 |
{ |
| 1912 |
bool set; |
| 1913 |
uint32_t out_peers; |
| 1914 |
|
| 1915 |
BEGIN_KV_SERIALIZE_MAP() |
| 1916 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1917 |
KV_SERIALIZE_OPT(set, true) |
| 1918 |
KV_SERIALIZE(out_peers) |
| 1919 |
END_KV_SERIALIZE_MAP() |
| 1920 |
}; |
| 1921 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1922 |
|
| 1923 |
struct response_t: public rpc_response_base |
| 1924 |
{ |
| 1925 |
uint32_t out_peers; |
| 1926 |
|
| 1927 |
BEGIN_KV_SERIALIZE_MAP() |
| 1928 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1929 |
KV_SERIALIZE(out_peers) |
| 1930 |
END_KV_SERIALIZE_MAP() |
| 1931 |
}; |
| 1932 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1933 |
}; |
| 1934 |
|
| 1935 |
struct COMMAND_RPC_IN_PEERS |
| 1936 |
{ |
| 1937 |
struct request_t: public rpc_request_base |
| 1938 |
{ |
| 1939 |
bool set; |
| 1940 |
uint32_t in_peers; |
| 1941 |
BEGIN_KV_SERIALIZE_MAP() |
| 1942 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 1943 |
KV_SERIALIZE_OPT(set, true) |
| 1944 |
KV_SERIALIZE(in_peers) |
| 1945 |
END_KV_SERIALIZE_MAP() |
| 1946 |
}; |
| 1947 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1948 |
|
| 1949 |
struct response_t: public rpc_response_base |
| 1950 |
{ |
| 1951 |
uint32_t in_peers; |
| 1952 |
|
| 1953 |
BEGIN_KV_SERIALIZE_MAP() |
| 1954 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 1955 |
KV_SERIALIZE(in_peers) |
| 1956 |
END_KV_SERIALIZE_MAP() |
| 1957 |
}; |
| 1958 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1959 |
}; |
| 1960 |
|
| 1961 |
struct COMMAND_RPC_HARD_FORK_INFO |
| 1962 |
{ |
| 1963 |
struct request_t: public rpc_access_request_base |
| 1964 |
{ |
| 1965 |
uint8_t version; |
| 1966 |
|
| 1967 |
BEGIN_KV_SERIALIZE_MAP() |
| 1968 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 1969 |
KV_SERIALIZE(version) |
| 1970 |
END_KV_SERIALIZE_MAP() |
| 1971 |
}; |
| 1972 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 1973 |
|
| 1974 |
struct response_t: public rpc_access_response_base |
| 1975 |
{ |
| 1976 |
uint8_t version; |
| 1977 |
bool enabled; |
| 1978 |
uint32_t window; |
| 1979 |
uint32_t votes; |
| 1980 |
uint32_t threshold; |
| 1981 |
uint8_t voting; |
| 1982 |
uint32_t state; |
| 1983 |
uint64_t earliest_height; |
| 1984 |
|
| 1985 |
BEGIN_KV_SERIALIZE_MAP() |
| 1986 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 1987 |
KV_SERIALIZE(version) |
| 1988 |
KV_SERIALIZE(enabled) |
| 1989 |
KV_SERIALIZE(window) |
| 1990 |
KV_SERIALIZE(votes) |
| 1991 |
KV_SERIALIZE(threshold) |
| 1992 |
KV_SERIALIZE(voting) |
| 1993 |
KV_SERIALIZE(state) |
| 1994 |
KV_SERIALIZE(earliest_height) |
| 1995 |
END_KV_SERIALIZE_MAP() |
| 1996 |
}; |
| 1997 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 1998 |
}; |
| 1999 |
|
| 2000 |
struct COMMAND_RPC_GETBANS |
| 2001 |
{ |
| 2002 |
struct ban |
| 2003 |
{ |
| 2004 |
std::string host; |
| 2005 |
uint32_t ip; |
| 2006 |
uint32_t seconds; |
| 2007 |
|
| 2008 |
BEGIN_KV_SERIALIZE_MAP() |
| 2009 |
KV_SERIALIZE(host) |
| 2010 |
KV_SERIALIZE(ip) |
| 2011 |
KV_SERIALIZE(seconds) |
| 2012 |
END_KV_SERIALIZE_MAP() |
| 2013 |
}; |
| 2014 |
|
| 2015 |
struct request_t: public rpc_request_base |
| 2016 |
{ |
| 2017 |
BEGIN_KV_SERIALIZE_MAP() |
| 2018 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2019 |
END_KV_SERIALIZE_MAP() |
| 2020 |
}; |
| 2021 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2022 |
|
| 2023 |
struct response_t: public rpc_response_base |
| 2024 |
{ |
| 2025 |
std::vector<ban> bans; |
| 2026 |
|
| 2027 |
BEGIN_KV_SERIALIZE_MAP() |
| 2028 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2029 |
KV_SERIALIZE(bans) |
| 2030 |
END_KV_SERIALIZE_MAP() |
| 2031 |
}; |
| 2032 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2033 |
}; |
| 2034 |
|
| 2035 |
struct COMMAND_RPC_SETBANS |
| 2036 |
{ |
| 2037 |
struct ban |
| 2038 |
{ |
| 2039 |
std::string host; |
| 2040 |
uint32_t ip; |
| 2041 |
bool ban; |
| 2042 |
uint32_t seconds; |
| 2043 |
|
| 2044 |
BEGIN_KV_SERIALIZE_MAP() |
| 2045 |
KV_SERIALIZE(host) |
| 2046 |
KV_SERIALIZE(ip) |
| 2047 |
KV_SERIALIZE(ban) |
| 2048 |
KV_SERIALIZE(seconds) |
| 2049 |
END_KV_SERIALIZE_MAP() |
| 2050 |
}; |
| 2051 |
|
| 2052 |
struct request_t: public rpc_request_base |
| 2053 |
{ |
| 2054 |
std::vector<ban> bans; |
| 2055 |
|
| 2056 |
BEGIN_KV_SERIALIZE_MAP() |
| 2057 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2058 |
KV_SERIALIZE(bans) |
| 2059 |
END_KV_SERIALIZE_MAP() |
| 2060 |
}; |
| 2061 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2062 |
|
| 2063 |
struct response_t: public rpc_response_base |
| 2064 |
{ |
| 2065 |
BEGIN_KV_SERIALIZE_MAP() |
| 2066 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2067 |
END_KV_SERIALIZE_MAP() |
| 2068 |
}; |
| 2069 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2070 |
}; |
| 2071 |
|
| 2072 |
struct COMMAND_RPC_BANNED |
| 2073 |
{ |
| 2074 |
struct request_t |
| 2075 |
{ |
| 2076 |
std::string address; |
| 2077 |
|
| 2078 |
BEGIN_KV_SERIALIZE_MAP() |
| 2079 |
KV_SERIALIZE(address) |
| 2080 |
END_KV_SERIALIZE_MAP() |
| 2081 |
}; |
| 2082 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2083 |
|
| 2084 |
struct response_t |
| 2085 |
{ |
| 2086 |
std::string status; |
| 2087 |
bool banned; |
| 2088 |
uint32_t seconds; |
| 2089 |
|
| 2090 |
BEGIN_KV_SERIALIZE_MAP() |
| 2091 |
KV_SERIALIZE(status) |
| 2092 |
KV_SERIALIZE(banned) |
| 2093 |
KV_SERIALIZE(seconds) |
| 2094 |
END_KV_SERIALIZE_MAP() |
| 2095 |
}; |
| 2096 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2097 |
}; |
| 2098 |
|
| 2099 |
struct COMMAND_RPC_FLUSH_TRANSACTION_POOL |
| 2100 |
{ |
| 2101 |
struct request_t: public rpc_request_base |
| 2102 |
{ |
| 2103 |
std::vector<std::string> txids; |
| 2104 |
|
| 2105 |
BEGIN_KV_SERIALIZE_MAP() |
| 2106 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2107 |
KV_SERIALIZE(txids) |
| 2108 |
END_KV_SERIALIZE_MAP() |
| 2109 |
}; |
| 2110 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2111 |
|
| 2112 |
struct response_t: public rpc_response_base |
| 2113 |
{ |
| 2114 |
BEGIN_KV_SERIALIZE_MAP() |
| 2115 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2116 |
END_KV_SERIALIZE_MAP() |
| 2117 |
}; |
| 2118 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2119 |
}; |
| 2120 |
|
| 2121 |
struct COMMAND_RPC_GET_OUTPUT_HISTOGRAM |
| 2122 |
{ |
| 2123 |
struct request_t: public rpc_access_request_base |
| 2124 |
{ |
| 2125 |
std::vector<uint64_t> amounts; |
| 2126 |
uint64_t min_count; |
| 2127 |
uint64_t max_count; |
| 2128 |
bool unlocked; |
| 2129 |
uint64_t recent_cutoff; |
| 2130 |
|
| 2131 |
BEGIN_KV_SERIALIZE_MAP() |
| 2132 |
KV_SERIALIZE_PARENT(rpc_access_request_base); |
| 2133 |
KV_SERIALIZE(amounts); |
| 2134 |
KV_SERIALIZE(min_count); |
| 2135 |
KV_SERIALIZE(max_count); |
| 2136 |
KV_SERIALIZE(unlocked); |
| 2137 |
KV_SERIALIZE(recent_cutoff); |
| 2138 |
END_KV_SERIALIZE_MAP() |
| 2139 |
}; |
| 2140 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2141 |
|
| 2142 |
struct entry |
| 2143 |
{ |
| 2144 |
uint64_t amount; |
| 2145 |
uint64_t total_instances; |
| 2146 |
uint64_t unlocked_instances; |
| 2147 |
uint64_t recent_instances; |
| 2148 |
|
| 2149 |
BEGIN_KV_SERIALIZE_MAP() |
| 2150 |
KV_SERIALIZE(amount); |
| 2151 |
KV_SERIALIZE(total_instances); |
| 2152 |
KV_SERIALIZE(unlocked_instances); |
| 2153 |
KV_SERIALIZE(recent_instances); |
| 2154 |
END_KV_SERIALIZE_MAP() |
| 2155 |
|
| 2156 |
entry(uint64_t amount, uint64_t total_instances, uint64_t unlocked_instances, uint64_t recent_instances): |
| 2157 |
amount(amount), total_instances(total_instances), unlocked_instances(unlocked_instances), recent_instances(recent_instances) {} |
| 2158 |
entry() {} |
| 2159 |
}; |
| 2160 |
|
| 2161 |
struct response_t: public rpc_access_response_base |
| 2162 |
{ |
| 2163 |
std::vector<entry> histogram; |
| 2164 |
|
| 2165 |
BEGIN_KV_SERIALIZE_MAP() |
| 2166 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2167 |
KV_SERIALIZE(histogram) |
| 2168 |
END_KV_SERIALIZE_MAP() |
| 2169 |
}; |
| 2170 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2171 |
}; |
| 2172 |
|
| 2173 |
struct COMMAND_RPC_GET_VERSION |
| 2174 |
{ |
| 2175 |
struct request_t: public rpc_request_base |
| 2176 |
{ |
| 2177 |
BEGIN_KV_SERIALIZE_MAP() |
| 2178 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2179 |
END_KV_SERIALIZE_MAP() |
| 2180 |
}; |
| 2181 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2182 |
|
| 2183 |
struct hf_entry |
| 2184 |
{ |
| 2185 |
uint8_t hf_version; |
| 2186 |
uint64_t height; |
| 2187 |
|
| 2188 |
bool operator==(const hf_entry& hfe) const { return hf_version == hfe.hf_version && height == hfe.height; } |
| 2189 |
|
| 2190 |
BEGIN_KV_SERIALIZE_MAP() |
| 2191 |
KV_SERIALIZE(hf_version) |
| 2192 |
KV_SERIALIZE(height) |
| 2193 |
END_KV_SERIALIZE_MAP() |
| 2194 |
}; |
| 2195 |
|
| 2196 |
struct response_t: public rpc_response_base |
| 2197 |
{ |
| 2198 |
uint32_t version; |
| 2199 |
bool release; |
| 2200 |
uint64_t current_height; |
| 2201 |
uint64_t target_height; |
| 2202 |
std::vector<hf_entry> hard_forks; |
| 2203 |
|
| 2204 |
BEGIN_KV_SERIALIZE_MAP() |
| 2205 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2206 |
KV_SERIALIZE(version) |
| 2207 |
KV_SERIALIZE(release) |
| 2208 |
KV_SERIALIZE_OPT(current_height, (uint64_t)0) |
| 2209 |
KV_SERIALIZE_OPT(target_height, (uint64_t)0) |
| 2210 |
KV_SERIALIZE_OPT(hard_forks, std::vector<hf_entry>()) |
| 2211 |
END_KV_SERIALIZE_MAP() |
| 2212 |
}; |
| 2213 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2214 |
}; |
| 2215 |
|
| 2216 |
struct COMMAND_RPC_GET_COINBASE_TX_SUM |
| 2217 |
{ |
| 2218 |
struct request_t: public rpc_access_request_base |
| 2219 |
{ |
| 2220 |
uint64_t height; |
| 2221 |
uint64_t count; |
| 2222 |
|
| 2223 |
BEGIN_KV_SERIALIZE_MAP() |
| 2224 |
KV_SERIALIZE_PARENT(rpc_access_request_base); |
| 2225 |
KV_SERIALIZE(height); |
| 2226 |
KV_SERIALIZE(count); |
| 2227 |
END_KV_SERIALIZE_MAP() |
| 2228 |
}; |
| 2229 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2230 |
|
| 2231 |
struct response_t: public rpc_access_response_base |
| 2232 |
{ |
| 2233 |
uint64_t emission_amount; |
| 2234 |
std::string wide_emission_amount; |
| 2235 |
uint64_t emission_amount_top64; |
| 2236 |
uint64_t fee_amount; |
| 2237 |
std::string wide_fee_amount; |
| 2238 |
uint64_t fee_amount_top64; |
| 2239 |
|
| 2240 |
BEGIN_KV_SERIALIZE_MAP() |
| 2241 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2242 |
KV_SERIALIZE(emission_amount) |
| 2243 |
KV_SERIALIZE(wide_emission_amount) |
| 2244 |
KV_SERIALIZE(emission_amount_top64) |
| 2245 |
KV_SERIALIZE(fee_amount) |
| 2246 |
KV_SERIALIZE(wide_fee_amount) |
| 2247 |
KV_SERIALIZE(fee_amount_top64) |
| 2248 |
END_KV_SERIALIZE_MAP() |
| 2249 |
}; |
| 2250 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2251 |
}; |
| 2252 |
|
| 2253 |
struct COMMAND_RPC_GET_BASE_FEE_ESTIMATE |
| 2254 |
{ |
| 2255 |
struct request_t: public rpc_access_request_base |
| 2256 |
{ |
| 2257 |
uint64_t grace_blocks; |
| 2258 |
|
| 2259 |
BEGIN_KV_SERIALIZE_MAP() |
| 2260 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 2261 |
KV_SERIALIZE(grace_blocks) |
| 2262 |
END_KV_SERIALIZE_MAP() |
| 2263 |
}; |
| 2264 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2265 |
|
| 2266 |
struct response_t: public rpc_access_response_base |
| 2267 |
{ |
| 2268 |
uint64_t fee; |
| 2269 |
uint64_t quantization_mask; |
| 2270 |
std::vector<uint64_t> fees; |
| 2271 |
|
| 2272 |
BEGIN_KV_SERIALIZE_MAP() |
| 2273 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2274 |
KV_SERIALIZE(fee) |
| 2275 |
KV_SERIALIZE_OPT(quantization_mask, (uint64_t)1) |
| 2276 |
KV_SERIALIZE(fees) |
| 2277 |
END_KV_SERIALIZE_MAP() |
| 2278 |
}; |
| 2279 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2280 |
}; |
| 2281 |
|
| 2282 |
struct COMMAND_RPC_GET_ALTERNATE_CHAINS |
| 2283 |
{ |
| 2284 |
struct request_t: public rpc_request_base |
| 2285 |
{ |
| 2286 |
BEGIN_KV_SERIALIZE_MAP() |
| 2287 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2288 |
END_KV_SERIALIZE_MAP() |
| 2289 |
}; |
| 2290 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2291 |
|
| 2292 |
struct chain_info |
| 2293 |
{ |
| 2294 |
std::string block_hash; |
| 2295 |
uint64_t height; |
| 2296 |
uint64_t length; |
| 2297 |
uint64_t difficulty; |
| 2298 |
std::string wide_difficulty; |
| 2299 |
uint64_t difficulty_top64; |
| 2300 |
std::vector<std::string> block_hashes; |
| 2301 |
std::string main_chain_parent_block; |
| 2302 |
|
| 2303 |
BEGIN_KV_SERIALIZE_MAP() |
| 2304 |
KV_SERIALIZE(block_hash) |
| 2305 |
KV_SERIALIZE(height) |
| 2306 |
KV_SERIALIZE(length) |
| 2307 |
KV_SERIALIZE(difficulty) |
| 2308 |
KV_SERIALIZE(wide_difficulty) |
| 2309 |
KV_SERIALIZE(difficulty_top64) |
| 2310 |
KV_SERIALIZE(block_hashes) |
| 2311 |
KV_SERIALIZE(main_chain_parent_block) |
| 2312 |
END_KV_SERIALIZE_MAP() |
| 2313 |
}; |
| 2314 |
|
| 2315 |
struct response_t: public rpc_response_base |
| 2316 |
{ |
| 2317 |
std::vector<chain_info> chains; |
| 2318 |
|
| 2319 |
BEGIN_KV_SERIALIZE_MAP() |
| 2320 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2321 |
KV_SERIALIZE(chains) |
| 2322 |
END_KV_SERIALIZE_MAP() |
| 2323 |
}; |
| 2324 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2325 |
}; |
| 2326 |
|
| 2327 |
struct COMMAND_RPC_UPDATE |
| 2328 |
{ |
| 2329 |
struct request_t: public rpc_request_base |
| 2330 |
{ |
| 2331 |
std::string command; |
| 2332 |
std::string path; |
| 2333 |
|
| 2334 |
BEGIN_KV_SERIALIZE_MAP() |
| 2335 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2336 |
KV_SERIALIZE(command) |
| 2337 |
KV_SERIALIZE(path) |
| 2338 |
END_KV_SERIALIZE_MAP() |
| 2339 |
}; |
| 2340 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2341 |
|
| 2342 |
struct response_t: public rpc_response_base |
| 2343 |
{ |
| 2344 |
bool update; |
| 2345 |
std::string version; |
| 2346 |
std::string user_uri; |
| 2347 |
std::string auto_uri; |
| 2348 |
std::string hash; |
| 2349 |
std::string path; |
| 2350 |
|
| 2351 |
BEGIN_KV_SERIALIZE_MAP() |
| 2352 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2353 |
KV_SERIALIZE(update) |
| 2354 |
KV_SERIALIZE(version) |
| 2355 |
KV_SERIALIZE(user_uri) |
| 2356 |
KV_SERIALIZE(auto_uri) |
| 2357 |
KV_SERIALIZE(hash) |
| 2358 |
KV_SERIALIZE(path) |
| 2359 |
END_KV_SERIALIZE_MAP() |
| 2360 |
}; |
| 2361 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2362 |
}; |
| 2363 |
|
| 2364 |
struct COMMAND_RPC_RELAY_TX |
| 2365 |
{ |
| 2366 |
struct request_t: public rpc_access_request_base |
| 2367 |
{ |
| 2368 |
std::vector<std::string> txids; |
| 2369 |
|
| 2370 |
BEGIN_KV_SERIALIZE_MAP() |
| 2371 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 2372 |
KV_SERIALIZE(txids) |
| 2373 |
END_KV_SERIALIZE_MAP() |
| 2374 |
}; |
| 2375 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2376 |
|
| 2377 |
struct response_t: public rpc_access_response_base |
| 2378 |
{ |
| 2379 |
BEGIN_KV_SERIALIZE_MAP() |
| 2380 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2381 |
END_KV_SERIALIZE_MAP() |
| 2382 |
}; |
| 2383 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2384 |
}; |
| 2385 |
|
| 2386 |
struct COMMAND_RPC_SYNC_INFO |
| 2387 |
{ |
| 2388 |
struct request_t: public rpc_access_request_base |
| 2389 |
{ |
| 2390 |
BEGIN_KV_SERIALIZE_MAP() |
| 2391 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 2392 |
END_KV_SERIALIZE_MAP() |
| 2393 |
}; |
| 2394 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2395 |
|
| 2396 |
struct peer |
| 2397 |
{ |
| 2398 |
connection_info info; |
| 2399 |
|
| 2400 |
BEGIN_KV_SERIALIZE_MAP() |
| 2401 |
KV_SERIALIZE(info) |
| 2402 |
END_KV_SERIALIZE_MAP() |
| 2403 |
}; |
| 2404 |
|
| 2405 |
struct span |
| 2406 |
{ |
| 2407 |
uint64_t start_block_height; |
| 2408 |
uint64_t nblocks; |
| 2409 |
std::string connection_id; |
| 2410 |
uint32_t rate; |
| 2411 |
uint32_t speed; |
| 2412 |
uint64_t size; |
| 2413 |
std::string remote_address; |
| 2414 |
|
| 2415 |
BEGIN_KV_SERIALIZE_MAP() |
| 2416 |
KV_SERIALIZE(start_block_height) |
| 2417 |
KV_SERIALIZE(nblocks) |
| 2418 |
KV_SERIALIZE(connection_id) |
| 2419 |
KV_SERIALIZE(rate) |
| 2420 |
KV_SERIALIZE(speed) |
| 2421 |
KV_SERIALIZE(size) |
| 2422 |
KV_SERIALIZE(remote_address) |
| 2423 |
END_KV_SERIALIZE_MAP() |
| 2424 |
}; |
| 2425 |
|
| 2426 |
struct response_t: public rpc_access_response_base |
| 2427 |
{ |
| 2428 |
uint64_t height; |
| 2429 |
uint64_t target_height; |
| 2430 |
uint32_t next_needed_pruning_seed; |
| 2431 |
std::list<peer> peers; |
| 2432 |
std::list<span> spans; |
| 2433 |
std::string overview; |
| 2434 |
|
| 2435 |
BEGIN_KV_SERIALIZE_MAP() |
| 2436 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2437 |
KV_SERIALIZE(height) |
| 2438 |
KV_SERIALIZE(target_height) |
| 2439 |
KV_SERIALIZE(next_needed_pruning_seed) |
| 2440 |
KV_SERIALIZE(peers) |
| 2441 |
KV_SERIALIZE(spans) |
| 2442 |
KV_SERIALIZE(overview) |
| 2443 |
END_KV_SERIALIZE_MAP() |
| 2444 |
}; |
| 2445 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2446 |
}; |
| 2447 |
|
| 2448 |
struct COMMAND_RPC_GET_OUTPUT_DISTRIBUTION |
| 2449 |
{ |
| 2450 |
struct request_t: public rpc_access_request_base |
| 2451 |
{ |
| 2452 |
std::vector<uint64_t> amounts; |
| 2453 |
uint64_t from_height; |
| 2454 |
uint64_t to_height; |
| 2455 |
bool cumulative; |
| 2456 |
bool binary; |
| 2457 |
bool compress; |
| 2458 |
|
| 2459 |
BEGIN_KV_SERIALIZE_MAP() |
| 2460 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 2461 |
KV_SERIALIZE(amounts) |
| 2462 |
KV_SERIALIZE_OPT(from_height, (uint64_t)0) |
| 2463 |
KV_SERIALIZE_OPT(to_height, (uint64_t)0) |
| 2464 |
KV_SERIALIZE_OPT(cumulative, false) |
| 2465 |
KV_SERIALIZE_OPT(binary, true) |
| 2466 |
KV_SERIALIZE_OPT(compress, false) |
| 2467 |
END_KV_SERIALIZE_MAP() |
| 2468 |
}; |
| 2469 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2470 |
|
| 2471 |
struct distribution |
| 2472 |
{ |
| 2473 |
rpc::output_distribution_data data; |
| 2474 |
uint64_t amount; |
| 2475 |
std::string compressed_data; |
| 2476 |
bool binary; |
| 2477 |
bool compress; |
| 2478 |
|
| 2479 |
BEGIN_KV_SERIALIZE_MAP() |
| 2480 |
KV_SERIALIZE(amount) |
| 2481 |
KV_SERIALIZE_N(data.start_height, "start_height") |
| 2482 |
KV_SERIALIZE(binary) |
| 2483 |
KV_SERIALIZE(compress) |
| 2484 |
if (this_ref.binary) |
| 2485 |
{ |
| 2486 |
if (is_store) |
| 2487 |
{ |
| 2488 |
if (this_ref.compress) |
| 2489 |
{ |
| 2490 |
const_cast<std::string&>(this_ref.compressed_data) = compress_integer_array(this_ref.data.distribution); |
| 2491 |
KV_SERIALIZE(compressed_data) |
| 2492 |
} |
| 2493 |
else |
| 2494 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(data.distribution, "distribution") |
| 2495 |
} |
| 2496 |
else |
| 2497 |
{ |
| 2498 |
if (this_ref.compress) |
| 2499 |
{ |
| 2500 |
KV_SERIALIZE(compressed_data) |
| 2501 |
const_cast<std::vector<uint64_t>&>(this_ref.data.distribution) = decompress_integer_array<uint64_t>(this_ref.compressed_data); |
| 2502 |
} |
| 2503 |
else |
| 2504 |
KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(data.distribution, "distribution") |
| 2505 |
} |
| 2506 |
} |
| 2507 |
else |
| 2508 |
KV_SERIALIZE_N(data.distribution, "distribution") |
| 2509 |
KV_SERIALIZE_N(data.base, "base") |
| 2510 |
END_KV_SERIALIZE_MAP() |
| 2511 |
}; |
| 2512 |
|
| 2513 |
struct response_t: public rpc_access_response_base |
| 2514 |
{ |
| 2515 |
std::vector<distribution> distributions; |
| 2516 |
|
| 2517 |
BEGIN_KV_SERIALIZE_MAP() |
| 2518 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2519 |
KV_SERIALIZE(distributions) |
| 2520 |
END_KV_SERIALIZE_MAP() |
| 2521 |
}; |
| 2522 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2523 |
}; |
| 2524 |
|
| 2525 |
struct COMMAND_RPC_ACCESS_INFO |
| 2526 |
{ |
| 2527 |
struct request_t: public rpc_access_request_base |
| 2528 |
{ |
| 2529 |
BEGIN_KV_SERIALIZE_MAP() |
| 2530 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 2531 |
END_KV_SERIALIZE_MAP() |
| 2532 |
}; |
| 2533 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2534 |
|
| 2535 |
struct response_t: public rpc_access_response_base |
| 2536 |
{ |
| 2537 |
std::string hashing_blob; |
| 2538 |
uint64_t seed_height; |
| 2539 |
std::string seed_hash; |
| 2540 |
std::string next_seed_hash; |
| 2541 |
uint32_t cookie; |
| 2542 |
uint64_t diff; |
| 2543 |
uint64_t credits_per_hash_found; |
| 2544 |
uint64_t height; |
| 2545 |
|
| 2546 |
BEGIN_KV_SERIALIZE_MAP() |
| 2547 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2548 |
KV_SERIALIZE(hashing_blob) |
| 2549 |
KV_SERIALIZE(seed_height) |
| 2550 |
KV_SERIALIZE(seed_hash) |
| 2551 |
KV_SERIALIZE(next_seed_hash) |
| 2552 |
KV_SERIALIZE(cookie) |
| 2553 |
KV_SERIALIZE(diff) |
| 2554 |
KV_SERIALIZE(credits_per_hash_found) |
| 2555 |
KV_SERIALIZE(height) |
| 2556 |
END_KV_SERIALIZE_MAP() |
| 2557 |
}; |
| 2558 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2559 |
}; |
| 2560 |
|
| 2561 |
struct COMMAND_RPC_ACCESS_SUBMIT_NONCE |
| 2562 |
{ |
| 2563 |
struct request_t: public rpc_access_request_base |
| 2564 |
{ |
| 2565 |
uint32_t nonce; |
| 2566 |
uint32_t cookie; |
| 2567 |
|
| 2568 |
BEGIN_KV_SERIALIZE_MAP() |
| 2569 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 2570 |
KV_SERIALIZE(nonce) |
| 2571 |
KV_SERIALIZE(cookie) |
| 2572 |
END_KV_SERIALIZE_MAP() |
| 2573 |
}; |
| 2574 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2575 |
|
| 2576 |
struct response_t: public rpc_access_response_base |
| 2577 |
{ |
| 2578 |
BEGIN_KV_SERIALIZE_MAP() |
| 2579 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2580 |
END_KV_SERIALIZE_MAP() |
| 2581 |
}; |
| 2582 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2583 |
}; |
| 2584 |
|
| 2585 |
struct COMMAND_RPC_ACCESS_PAY |
| 2586 |
{ |
| 2587 |
struct request_t: public rpc_access_request_base |
| 2588 |
{ |
| 2589 |
std::string paying_for; |
| 2590 |
uint64_t payment; |
| 2591 |
|
| 2592 |
BEGIN_KV_SERIALIZE_MAP() |
| 2593 |
KV_SERIALIZE_PARENT(rpc_access_request_base) |
| 2594 |
KV_SERIALIZE(paying_for) |
| 2595 |
KV_SERIALIZE(payment) |
| 2596 |
END_KV_SERIALIZE_MAP() |
| 2597 |
}; |
| 2598 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2599 |
|
| 2600 |
struct response_t: public rpc_access_response_base |
| 2601 |
{ |
| 2602 |
BEGIN_KV_SERIALIZE_MAP() |
| 2603 |
KV_SERIALIZE_PARENT(rpc_access_response_base) |
| 2604 |
END_KV_SERIALIZE_MAP() |
| 2605 |
}; |
| 2606 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2607 |
}; |
| 2608 |
|
| 2609 |
struct COMMAND_RPC_ACCESS_TRACKING |
| 2610 |
{ |
| 2611 |
struct request_t: public rpc_request_base |
| 2612 |
{ |
| 2613 |
bool clear; |
| 2614 |
|
| 2615 |
BEGIN_KV_SERIALIZE_MAP() |
| 2616 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2617 |
KV_SERIALIZE(clear) |
| 2618 |
END_KV_SERIALIZE_MAP() |
| 2619 |
}; |
| 2620 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2621 |
|
| 2622 |
struct entry |
| 2623 |
{ |
| 2624 |
std::string rpc; |
| 2625 |
uint64_t count; |
| 2626 |
uint64_t time; |
| 2627 |
uint64_t credits; |
| 2628 |
|
| 2629 |
BEGIN_KV_SERIALIZE_MAP() |
| 2630 |
KV_SERIALIZE(rpc) |
| 2631 |
KV_SERIALIZE(count) |
| 2632 |
KV_SERIALIZE(time) |
| 2633 |
KV_SERIALIZE(credits) |
| 2634 |
END_KV_SERIALIZE_MAP() |
| 2635 |
}; |
| 2636 |
|
| 2637 |
struct response_t: public rpc_response_base |
| 2638 |
{ |
| 2639 |
std::vector<entry> data; |
| 2640 |
|
| 2641 |
BEGIN_KV_SERIALIZE_MAP() |
| 2642 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2643 |
KV_SERIALIZE(data) |
| 2644 |
END_KV_SERIALIZE_MAP() |
| 2645 |
}; |
| 2646 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2647 |
}; |
| 2648 |
|
| 2649 |
struct COMMAND_RPC_ACCESS_DATA |
| 2650 |
{ |
| 2651 |
struct request_t: public rpc_request_base |
| 2652 |
{ |
| 2653 |
BEGIN_KV_SERIALIZE_MAP() |
| 2654 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2655 |
END_KV_SERIALIZE_MAP() |
| 2656 |
}; |
| 2657 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2658 |
|
| 2659 |
struct entry |
| 2660 |
{ |
| 2661 |
std::string client; |
| 2662 |
uint64_t balance; |
| 2663 |
uint64_t last_update_time; |
| 2664 |
uint64_t credits_total; |
| 2665 |
uint64_t credits_used; |
| 2666 |
uint64_t nonces_good; |
| 2667 |
uint64_t nonces_stale; |
| 2668 |
uint64_t nonces_bad; |
| 2669 |
uint64_t nonces_dupe; |
| 2670 |
|
| 2671 |
BEGIN_KV_SERIALIZE_MAP() |
| 2672 |
KV_SERIALIZE(client) |
| 2673 |
KV_SERIALIZE(balance) |
| 2674 |
KV_SERIALIZE(last_update_time) |
| 2675 |
KV_SERIALIZE(credits_total) |
| 2676 |
KV_SERIALIZE(credits_used) |
| 2677 |
KV_SERIALIZE(nonces_good) |
| 2678 |
KV_SERIALIZE(nonces_stale) |
| 2679 |
KV_SERIALIZE(nonces_bad) |
| 2680 |
KV_SERIALIZE(nonces_dupe) |
| 2681 |
END_KV_SERIALIZE_MAP() |
| 2682 |
}; |
| 2683 |
|
| 2684 |
struct response_t: public rpc_response_base |
| 2685 |
{ |
| 2686 |
std::list<entry> entries; |
| 2687 |
uint32_t hashrate; |
| 2688 |
|
| 2689 |
BEGIN_KV_SERIALIZE_MAP() |
| 2690 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2691 |
KV_SERIALIZE(entries) |
| 2692 |
KV_SERIALIZE(hashrate) |
| 2693 |
END_KV_SERIALIZE_MAP() |
| 2694 |
}; |
| 2695 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2696 |
}; |
| 2697 |
|
| 2698 |
struct COMMAND_RPC_ACCESS_ACCOUNT |
| 2699 |
{ |
| 2700 |
struct request_t: public rpc_request_base |
| 2701 |
{ |
| 2702 |
std::string client; |
| 2703 |
int64_t delta_balance; |
| 2704 |
|
| 2705 |
BEGIN_KV_SERIALIZE_MAP() |
| 2706 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2707 |
KV_SERIALIZE(client) |
| 2708 |
KV_SERIALIZE_OPT(delta_balance, (int64_t)0) |
| 2709 |
END_KV_SERIALIZE_MAP() |
| 2710 |
}; |
| 2711 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2712 |
|
| 2713 |
struct response_t: public rpc_response_base |
| 2714 |
{ |
| 2715 |
uint64_t credits; |
| 2716 |
|
| 2717 |
BEGIN_KV_SERIALIZE_MAP() |
| 2718 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2719 |
KV_SERIALIZE(credits) |
| 2720 |
END_KV_SERIALIZE_MAP() |
| 2721 |
}; |
| 2722 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2723 |
}; |
| 2724 |
|
| 2725 |
struct COMMAND_RPC_POP_BLOCKS |
| 2726 |
{ |
| 2727 |
struct request_t: public rpc_request_base |
| 2728 |
{ |
| 2729 |
uint64_t nblocks; |
| 2730 |
|
| 2731 |
BEGIN_KV_SERIALIZE_MAP() |
| 2732 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2733 |
KV_SERIALIZE(nblocks) |
| 2734 |
END_KV_SERIALIZE_MAP() |
| 2735 |
}; |
| 2736 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2737 |
|
| 2738 |
struct response_t: public rpc_response_base |
| 2739 |
{ |
| 2740 |
uint64_t height; |
| 2741 |
|
| 2742 |
BEGIN_KV_SERIALIZE_MAP() |
| 2743 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2744 |
KV_SERIALIZE(height) |
| 2745 |
END_KV_SERIALIZE_MAP() |
| 2746 |
}; |
| 2747 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2748 |
}; |
| 2749 |
|
| 2750 |
struct COMMAND_RPC_PRUNE_BLOCKCHAIN |
| 2751 |
{ |
| 2752 |
struct request_t: public rpc_request_base |
| 2753 |
{ |
| 2754 |
bool check; |
| 2755 |
|
| 2756 |
BEGIN_KV_SERIALIZE_MAP() |
| 2757 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2758 |
KV_SERIALIZE_OPT(check, false) |
| 2759 |
END_KV_SERIALIZE_MAP() |
| 2760 |
}; |
| 2761 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2762 |
|
| 2763 |
struct response_t: public rpc_response_base |
| 2764 |
{ |
| 2765 |
bool pruned; |
| 2766 |
uint32_t pruning_seed; |
| 2767 |
|
| 2768 |
BEGIN_KV_SERIALIZE_MAP() |
| 2769 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2770 |
KV_SERIALIZE(pruned) |
| 2771 |
KV_SERIALIZE(pruning_seed) |
| 2772 |
END_KV_SERIALIZE_MAP() |
| 2773 |
}; |
| 2774 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2775 |
}; |
| 2776 |
|
| 2777 |
struct COMMAND_RPC_FLUSH_CACHE |
| 2778 |
{ |
| 2779 |
struct request_t: public rpc_request_base |
| 2780 |
{ |
| 2781 |
bool bad_blocks; |
| 2782 |
|
| 2783 |
BEGIN_KV_SERIALIZE_MAP() |
| 2784 |
KV_SERIALIZE_PARENT(rpc_request_base) |
| 2785 |
KV_SERIALIZE_OPT(bad_blocks, false) |
| 2786 |
END_KV_SERIALIZE_MAP() |
| 2787 |
}; |
| 2788 |
typedef epee::misc_utils::struct_init<request_t> request; |
| 2789 |
|
| 2790 |
struct response_t: public rpc_response_base |
| 2791 |
{ |
| 2792 |
BEGIN_KV_SERIALIZE_MAP() |
| 2793 |
KV_SERIALIZE_PARENT(rpc_response_base) |
| 2794 |
END_KV_SERIALIZE_MAP() |
| 2795 |
}; |
| 2796 |
typedef epee::misc_utils::struct_init<response_t> response; |
| 2797 |
}; |
| 2798 |
|
| 2799 |
} |