From ef93b0995c311e5d5f43a726dbe90aacca46faff Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 7 Dec 2018 15:46:52 +0000 Subject: [PATCH 1/3] various: remove unused variables --- src/cryptonote_core/blockchain.cpp | 2 -- src/device/device_ledger.cpp | 6 +----- src/ringct/rctSigs.cpp | 3 --- src/serialization/json_object.cpp | 1 - src/wallet/api/wallet.cpp | 1 - src/wallet/wallet2.cpp | 1 - src/wallet/wallet_rpc_server.cpp | 5 ----- 7 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 8fc401851..9f1f376f3 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -1746,7 +1746,6 @@ bool Blockchain::handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NO for (auto& bl: blocks) { std::vector missed_tx_ids; - std::vector txs; rsp.blocks.push_back(block_complete_entry()); block_complete_entry& e = rsp.blocks.back(); @@ -1774,7 +1773,6 @@ bool Blockchain::handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NO e.block = std::move(bl.first); } //get and pack other transactions, if needed - std::vector txs; get_transactions_blobs(arg.txs, rsp.txs, rsp.missed_ids); m_db->block_txn_stop(); diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp index 1f91427f0..3c7590861 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -275,7 +275,6 @@ namespace hw { int device_ledger::set_command_header(unsigned char ins, unsigned char p1, unsigned char p2) { reset_buffer(); - int offset = 0; this->buffer_send[0] = PROTOCOL_VERSION; this->buffer_send[1] = ins; this->buffer_send[2] = p1; @@ -695,7 +694,7 @@ namespace hw { bool device_ledger::verify_keys(const crypto::secret_key &secret_key, const crypto::public_key &public_key) { AUTO_LOCK_CMD(); - int offset, sw; + int offset; offset = set_command_header_noopt(INS_VERIFY_KEY); //sec @@ -1567,7 +1566,6 @@ namespace hw { bool device_ledger::mlsag_prepare(const rct::key &H, const rct::key &xx, rct::key &a, rct::key &aG, rct::key &aHP, rct::key &II) { AUTO_LOCK_CMD(); - unsigned char options; #ifdef DEBUG_HWDEVICE const rct::key H_x = H; @@ -1611,7 +1609,6 @@ namespace hw { bool device_ledger::mlsag_prepare(rct::key &a, rct::key &aG) { AUTO_LOCK_CMD(); - unsigned char options; #ifdef DEBUG_HWDEVICE rct::key a_x; @@ -1634,7 +1631,6 @@ namespace hw { bool device_ledger::mlsag_hash(const rct::keyV &long_message, rct::key &c) { AUTO_LOCK_CMD(); - unsigned char options; size_t cnt; #ifdef DEBUG_HWDEVICE diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index 81bec487c..25571238e 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -469,7 +469,6 @@ namespace rct { //Ver: // verifies the above sig is created corretly mgSig proveRctMG(const key &message, const ctkeyM & pubs, const ctkeyV & inSk, const ctkeyV &outSk, const ctkeyV & outPk, const multisig_kLRki *kLRki, key *mscout, unsigned int index, const key &txnFeeKey, hw::device &hwdev) { - mgSig mg; //setup vars size_t cols = pubs.size(); CHECK_AND_ASSERT_THROW_MES(cols >= 1, "Empty pubs"); @@ -527,7 +526,6 @@ namespace rct { // a_out, Cout is for the output commitment // index is the signing index.. mgSig proveRctMGSimple(const key &message, const ctkeyV & pubs, const ctkey & inSk, const key &a , const key &Cout, const multisig_kLRki *kLRki, key *mscout, unsigned int index, hw::device &hwdev) { - mgSig mg; //setup vars size_t rows = 1; size_t cols = pubs.size(); @@ -793,7 +791,6 @@ namespace rct { rv.p.bulletproofs.clear(); if (bulletproof) { - std::vector proof_amounts; size_t n_amounts = outamounts.size(); size_t amounts_proved = 0; if (rct_config.range_proof_type == RangeProofPaddedBulletproof) diff --git a/src/serialization/json_object.cpp b/src/serialization/json_object.cpp index ee4fa4a19..f0fc35855 100644 --- a/src/serialization/json_object.cpp +++ b/src/serialization/json_object.cpp @@ -563,7 +563,6 @@ void toJsonValue(rapidjson::Document& doc, const cryptonote::connection_info& in { val.SetObject(); - auto& al = doc.GetAllocator(); INSERT_INTO_JSON_OBJECT(val, doc, incoming, info.incoming); INSERT_INTO_JSON_OBJECT(val, doc, localhost, info.localhost); INSERT_INTO_JSON_OBJECT(val, doc, local_ip, info.local_ip); diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 2b7853330..44cd67657 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -1504,7 +1504,6 @@ PendingTransaction *WalletImpl::createSweepUnmixableTransaction() { clearStatus(); - vector dsts; cryptonote::tx_destination_entry de; PendingTransactionImpl * transaction = new PendingTransactionImpl(*this); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 48e794616..f2c0a7ba9 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1528,7 +1528,6 @@ void wallet2::cache_tx_data(const cryptonote::transaction& tx, const crypto::has // additional tx pubkeys and derivations for multi-destination transfers involving one or more subaddresses tx_extra_additional_pub_keys additional_tx_pub_keys; - std::vector additional_derivations; if (find_tx_extra_field_by_type(tx_cache_data.tx_extra_fields, additional_tx_pub_keys)) { for (size_t i = 0; i < additional_tx_pub_keys.data.size(); ++i) diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 2cfd39f04..9adfb06c8 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -2192,9 +2192,6 @@ namespace tools try { - uint64_t received; - bool in_pool; - uint64_t confirmations; res.good = m_wallet->check_tx_proof(txid, info.address, info.is_subaddress, req.message, req.signature, res.received, res.in_pool, res.confirmations); } catch (const std::exception &e) @@ -2911,8 +2908,6 @@ namespace tools std::vector languages; crypto::ElectrumWords::get_language_list(languages); std::vector::iterator it; - std::string wallet_file; - char *ptr; it = std::find(languages.begin(), languages.end(), req.language); if (it == languages.end()) From e396146aeebd61d6a26003045d554f6e94d5f028 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 18 Jan 2019 01:05:58 +0000 Subject: [PATCH 2/3] default initialize rpc structures --- contrib/epee/demo/iface/transport_defs.h | 12 +- contrib/epee/include/misc_language.h | 5 + contrib/epee/include/net/jsonrpc_structs.h | 14 + contrib/epee/tests/src/net/test_net.h | 13 +- src/cryptonote_basic/cryptonote_stat_info.h | 3 +- .../cryptonote_protocol_defs.h | 24 +- src/p2p/net_node.h | 5 +- src/p2p/p2p_protocol_defs.h | 44 +- src/rpc/core_rpc_server_commands_defs.h | 399 +++++++++------ src/wallet/message_transporter.cpp | 6 +- src/wallet/message_transporter.h | 3 +- src/wallet/wallet_rpc_server_commands_defs.h | 460 ++++++++++++------ 12 files changed, 658 insertions(+), 330 deletions(-) diff --git a/contrib/epee/demo/iface/transport_defs.h b/contrib/epee/demo/iface/transport_defs.h index 746694aa3..8638b5db9 100644 --- a/contrib/epee/demo/iface/transport_defs.h +++ b/contrib/epee/demo/iface/transport_defs.h @@ -81,7 +81,7 @@ namespace demo { const static int ID = 1000; - struct request + struct request_t { std::string example_string_data; some_test_data sub; @@ -91,9 +91,10 @@ namespace demo KV_SERIALIZE(sub) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { bool m_success; std::list subs; @@ -104,6 +105,7 @@ namespace demo END_KV_SERIALIZE_MAP() }; }; + typedef epee::misc_utils::struct_init response; @@ -111,7 +113,7 @@ namespace demo { const static int ID = 1001; - struct request + struct request_t { std::string example_string_data2; @@ -119,8 +121,9 @@ namespace demo KV_SERIALIZE(example_string_data2) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { bool m_success; @@ -129,6 +132,7 @@ namespace demo KV_SERIALIZE(m_success) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; diff --git a/contrib/epee/include/misc_language.h b/contrib/epee/include/misc_language.h index 7e4eb337d..5f7202150 100644 --- a/contrib/epee/include/misc_language.h +++ b/contrib/epee/include/misc_language.h @@ -159,5 +159,10 @@ namespace misc_utils return slc; } + template struct struct_init: T + { + struct_init(): T{} {} + }; + } } diff --git a/contrib/epee/include/net/jsonrpc_structs.h b/contrib/epee/include/net/jsonrpc_structs.h index 9df9e2596..b61c369f2 100644 --- a/contrib/epee/include/net/jsonrpc_structs.h +++ b/contrib/epee/include/net/jsonrpc_structs.h @@ -18,6 +18,8 @@ namespace epee epee::serialization::storage_entry id; t_param params; + request(): id{}, params{} {} + BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(jsonrpc) KV_SERIALIZE(id) @@ -30,6 +32,9 @@ namespace epee { int64_t code; std::string message; + + error(): code(0) {} + BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(code) KV_SERIALIZE(message) @@ -55,6 +60,9 @@ namespace epee t_param result; epee::serialization::storage_entry id; t_error error; + + response(): result{}, id(), error{} {} + BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(jsonrpc) KV_SERIALIZE(id) @@ -69,6 +77,9 @@ namespace epee std::string jsonrpc; t_param result; epee::serialization::storage_entry id; + + response(): result{}, id{} {} + BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(jsonrpc) KV_SERIALIZE(id) @@ -82,6 +93,9 @@ namespace epee std::string jsonrpc; t_error error; epee::serialization::storage_entry id; + + response(): error{}, id{} {} + BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(jsonrpc) KV_SERIALIZE(id) diff --git a/contrib/epee/tests/src/net/test_net.h b/contrib/epee/tests/src/net/test_net.h index 51b1f1ec6..f99639afc 100644 --- a/contrib/epee/tests/src/net/test_net.h +++ b/contrib/epee/tests/src/net/test_net.h @@ -62,7 +62,7 @@ namespace tests { const static int ID = 1000; - struct request + struct request_t { std::string example_string_data; @@ -75,9 +75,9 @@ namespace tests SERIALIZE_T(sub) END_NAMED_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - - struct response + struct response_t { bool m_success; uint64_t example_id_data; @@ -89,13 +89,14 @@ namespace tests SERIALIZE_STL_CONTAINER_T(subs) END_NAMED_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_EXAMPLE_2 { const static int ID = 1001; - struct request + struct request_t { std::string example_string_data2; uint64_t example_id_data; @@ -105,8 +106,9 @@ namespace tests SERIALIZE_STL_ANSI_STRING(example_string_data2) END_NAMED_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { bool m_success; uint64_t example_id_data; @@ -116,6 +118,7 @@ namespace tests SERIALIZE_POD(m_success) END_NAMED_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; typedef boost::uuids::uuid uuid; diff --git a/src/cryptonote_basic/cryptonote_stat_info.h b/src/cryptonote_basic/cryptonote_stat_info.h index c0be2144e..a09fa850b 100644 --- a/src/cryptonote_basic/cryptonote_stat_info.h +++ b/src/cryptonote_basic/cryptonote_stat_info.h @@ -34,7 +34,7 @@ namespace cryptonote { - struct core_stat_info + struct core_stat_info_t { uint64_t tx_pool_size; uint64_t blockchain_height; @@ -50,4 +50,5 @@ namespace cryptonote KV_SERIALIZE(top_block_id_str) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init core_stat_info; } diff --git a/src/cryptonote_protocol/cryptonote_protocol_defs.h b/src/cryptonote_protocol/cryptonote_protocol_defs.h index 2d5d10d67..23846dbf8 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_defs.h +++ b/src/cryptonote_protocol/cryptonote_protocol_defs.h @@ -128,7 +128,7 @@ namespace cryptonote { const static int ID = BC_COMMANDS_POOL_BASE + 1; - struct request + struct request_t { block_complete_entry b; uint64_t current_blockchain_height; @@ -138,6 +138,7 @@ namespace cryptonote KV_SERIALIZE(current_blockchain_height) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; }; /************************************************************************/ @@ -147,7 +148,7 @@ namespace cryptonote { const static int ID = BC_COMMANDS_POOL_BASE + 2; - struct request + struct request_t { std::vector txs; std::string _; // padding @@ -157,6 +158,7 @@ namespace cryptonote KV_SERIALIZE(_) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; }; /************************************************************************/ /* */ @@ -165,7 +167,7 @@ namespace cryptonote { const static int ID = BC_COMMANDS_POOL_BASE + 3; - struct request + struct request_t { std::vector txs; std::vector blocks; @@ -175,13 +177,14 @@ namespace cryptonote KV_SERIALIZE_CONTAINER_POD_AS_BLOB(blocks) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; }; struct NOTIFY_RESPONSE_GET_OBJECTS { const static int ID = BC_COMMANDS_POOL_BASE + 4; - struct request + struct request_t { std::vector txs; std::vector blocks; @@ -195,6 +198,7 @@ namespace cryptonote KV_SERIALIZE(current_blockchain_height) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; }; @@ -219,7 +223,7 @@ namespace cryptonote { const static int ID = BC_COMMANDS_POOL_BASE + 6; - struct request + struct request_t { std::list block_ids; /*IDs of the first 10 blocks are sequential, next goes with pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block */ @@ -227,13 +231,14 @@ namespace cryptonote KV_SERIALIZE_CONTAINER_POD_AS_BLOB(block_ids) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; }; struct NOTIFY_RESPONSE_CHAIN_ENTRY { const static int ID = BC_COMMANDS_POOL_BASE + 7; - struct request + struct request_t { uint64_t start_height; uint64_t total_height; @@ -247,6 +252,7 @@ namespace cryptonote KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_ids) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; }; /************************************************************************/ @@ -256,7 +262,7 @@ namespace cryptonote { const static int ID = BC_COMMANDS_POOL_BASE + 8; - struct request + struct request_t { block_complete_entry b; uint64_t current_blockchain_height; @@ -266,6 +272,7 @@ namespace cryptonote KV_SERIALIZE(current_blockchain_height) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; }; /************************************************************************/ @@ -275,7 +282,7 @@ namespace cryptonote { const static int ID = BC_COMMANDS_POOL_BASE + 9; - struct request + struct request_t { crypto::hash block_hash; uint64_t current_blockchain_height; @@ -287,6 +294,7 @@ namespace cryptonote KV_SERIALIZE_CONTAINER_POD_AS_BLOB(missing_tx_indices) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; }; } diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 58e3c8857..4c5f788c3 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -131,9 +131,9 @@ namespace nodetool struct network_zone; using connect_func = boost::optional(network_zone&, epee::net_utils::network_address const&, epee::net_utils::ssl_support_t); - struct config + struct config_t { - config() + config_t() : m_net_config(), m_peer_id(crypto::rand()), m_support_flags(0) @@ -143,6 +143,7 @@ namespace nodetool uint64_t m_peer_id; uint32_t m_support_flags; }; + typedef epee::misc_utils::struct_init config; struct network_zone { diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h index e9449b950..bb4fb9da2 100644 --- a/src/p2p/p2p_protocol_defs.h +++ b/src/p2p/p2p_protocol_defs.h @@ -179,7 +179,7 @@ namespace nodetool { const static int ID = P2P_COMMANDS_POOL_BASE + 1; - struct request + struct request_t { basic_node_data node_data; t_playload_type payload_data; @@ -189,8 +189,9 @@ namespace nodetool KV_SERIALIZE(payload_data) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { basic_node_data node_data; t_playload_type payload_data; @@ -230,7 +231,8 @@ namespace nodetool } END_KV_SERIALIZE_MAP() }; - }; + typedef epee::misc_utils::struct_init response; + }; /************************************************************************/ @@ -241,15 +243,16 @@ namespace nodetool { const static int ID = P2P_COMMANDS_POOL_BASE + 2; - struct request + struct request_t { t_playload_type payload_data; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(payload_data) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t local_time; t_playload_type payload_data; @@ -289,6 +292,7 @@ namespace nodetool } END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; /************************************************************************/ @@ -306,15 +310,16 @@ namespace nodetool #define PING_OK_RESPONSE_STATUS_TEXT "OK" - struct request + struct request_t { /*actually we don't need to send any real data*/ BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; peerid_type peer_id; @@ -324,6 +329,7 @@ namespace nodetool KV_SERIALIZE(peer_id) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; @@ -350,15 +356,16 @@ namespace nodetool { const static int ID = P2P_COMMANDS_POOL_BASE + 4; - struct request + struct request_t { proof_of_trust tr; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(tr) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string version; std::string os_version; @@ -374,6 +381,7 @@ namespace nodetool KV_SERIALIZE(payload_info) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; @@ -384,15 +392,16 @@ namespace nodetool { const static int ID = P2P_COMMANDS_POOL_BASE + 5; - struct request + struct request_t { proof_of_trust tr; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(tr) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::vector local_peerlist_white; std::vector local_peerlist_gray; @@ -407,6 +416,7 @@ namespace nodetool KV_SERIALIZE(local_time) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; /************************************************************************/ @@ -416,13 +426,14 @@ namespace nodetool { const static int ID = P2P_COMMANDS_POOL_BASE + 6; - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { peerid_type my_id; @@ -430,6 +441,7 @@ namespace nodetool KV_SERIALIZE(my_id) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; /************************************************************************/ @@ -439,13 +451,14 @@ namespace nodetool { const static int ID = P2P_COMMANDS_POOL_BASE + 7; - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint32_t support_flags; @@ -453,6 +466,7 @@ namespace nodetool KV_SERIALIZE(support_flags) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; #endif diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index e52e4fc67..88fa9b4e7 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -90,13 +90,14 @@ namespace cryptonote struct COMMAND_RPC_GET_HEIGHT { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t height; std::string status; @@ -108,12 +109,13 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_BLOCKS_FAST { - struct request + struct request_t { std::list block_ids; //*first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block */ uint64_t start_height; @@ -126,6 +128,7 @@ namespace cryptonote KV_SERIALIZE_OPT(no_miner_tx, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct tx_output_indices { @@ -145,7 +148,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::vector blocks; uint64_t start_height; @@ -163,19 +166,21 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_BLOCKS_BY_HEIGHT { - struct request + struct request_t { std::vector heights; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(heights) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::vector blocks; std::string status; @@ -187,17 +192,19 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_ALT_BLOCKS_HASHES { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::vector blks_hashes; std::string status; @@ -209,11 +216,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_HASHES_FAST { - struct request + struct request_t { std::list block_ids; //*first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block */ uint64_t start_height; @@ -222,8 +230,9 @@ namespace cryptonote KV_SERIALIZE(start_height) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::vector m_block_ids; uint64_t start_height; @@ -239,12 +248,13 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_GET_ADDRESS_TXS { - struct request + struct request_t { std::string address; std::string view_key; @@ -254,6 +264,7 @@ namespace cryptonote KV_SERIALIZE(view_key) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct spent_output { uint64_t amount; @@ -304,7 +315,7 @@ namespace cryptonote }; - struct response + struct response_t { //std::list txs_as_json; uint64_t total_received; @@ -324,12 +335,13 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_GET_ADDRESS_INFO { - struct request + struct request_t { std::string address; std::string view_key; @@ -339,6 +351,7 @@ namespace cryptonote KV_SERIALIZE(view_key) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct spent_output { @@ -356,10 +369,8 @@ namespace cryptonote KV_SERIALIZE(mixin) END_KV_SERIALIZE_MAP() }; - - - - struct response + + struct response_t { uint64_t locked_funds; uint64_t total_received; @@ -382,12 +393,13 @@ namespace cryptonote KV_SERIALIZE(spent_outputs) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_GET_UNSPENT_OUTS { - struct request + struct request_t { std::string amount; std::string address; @@ -406,6 +418,7 @@ namespace cryptonote KV_SERIALIZE(dust_threshold) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct output { @@ -437,7 +450,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { uint64_t amount; std::list outputs; @@ -452,12 +465,13 @@ namespace cryptonote KV_SERIALIZE(reason) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_GET_RANDOM_OUTS { - struct request + struct request_t { std::vector amounts; uint32_t count; @@ -467,6 +481,7 @@ namespace cryptonote KV_SERIALIZE(count) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct output { @@ -491,7 +506,7 @@ namespace cryptonote }; - struct response + struct response_t { std::vector amount_outs; std::string Error; @@ -500,11 +515,12 @@ namespace cryptonote KV_SERIALIZE(Error) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_SUBMIT_RAW_TX { - struct request + struct request_t { std::string address; std::string view_key; @@ -516,9 +532,10 @@ namespace cryptonote KV_SERIALIZE(tx) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::string error; @@ -528,11 +545,12 @@ namespace cryptonote KV_SERIALIZE(error) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_LOGIN { - struct request + struct request_t { std::string address; std::string view_key; @@ -544,9 +562,9 @@ namespace cryptonote KV_SERIALIZE(create_account) END_KV_SERIALIZE_MAP() }; - - - struct response + typedef epee::misc_utils::struct_init request; + + struct response_t { std::string status; std::string reason; @@ -558,11 +576,12 @@ namespace cryptonote KV_SERIALIZE(new_address) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_IMPORT_WALLET_REQUEST { - struct request + struct request_t { std::string address; std::string view_key; @@ -572,9 +591,9 @@ namespace cryptonote KV_SERIALIZE(view_key) END_KV_SERIALIZE_MAP() }; - - - struct response + typedef epee::misc_utils::struct_init request; + + struct response_t { std::string payment_id; uint64_t import_fee; @@ -592,11 +611,12 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_GET_TRANSACTIONS { - struct request + struct request_t { std::vector txs_hashes; bool decode_as_json; @@ -610,6 +630,7 @@ namespace cryptonote KV_SERIALIZE_OPT(split, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct entry { @@ -640,7 +661,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { // older compatibility stuff std::vector txs_as_hex; //transactions blobs as hex (old compat) @@ -663,6 +684,7 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- @@ -674,7 +696,7 @@ namespace cryptonote SPENT_IN_POOL = 2, }; - struct request + struct request_t { std::vector key_images; @@ -682,9 +704,10 @@ namespace cryptonote KV_SERIALIZE(key_images) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::vector spent_status; std::string status; @@ -696,21 +719,23 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES { - struct request + struct request_t { crypto::hash txid; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE_VAL_POD_AS_BLOB(txid) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::vector o_indexes; std::string status; @@ -721,6 +746,7 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct get_outputs_out @@ -736,7 +762,7 @@ namespace cryptonote struct COMMAND_RPC_GET_OUTPUTS_BIN { - struct request + struct request_t { std::vector outputs; bool get_txid; @@ -746,6 +772,7 @@ namespace cryptonote KV_SERIALIZE_OPT(get_txid, true) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct outkey { @@ -764,7 +791,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::vector outs; std::string status; @@ -776,11 +803,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_GET_OUTPUTS { - struct request + struct request_t { std::vector outputs; @@ -788,6 +816,7 @@ namespace cryptonote KV_SERIALIZE(outputs) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct outkey { @@ -806,7 +835,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::vector outs; std::string status; @@ -818,11 +847,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_SEND_RAW_TX { - struct request + struct request_t { std::string tx_as_hex; bool do_not_relay; @@ -832,9 +862,10 @@ namespace cryptonote KV_SERIALIZE_OPT(do_not_relay, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::string reason; @@ -864,11 +895,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_START_MINING { - struct request + struct request_t { std::string miner_address; uint64_t threads_count; @@ -882,8 +914,9 @@ namespace cryptonote KV_SERIALIZE(ignore_battery) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -891,18 +924,20 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_GET_INFO { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; uint64_t height; @@ -974,21 +1009,23 @@ namespace cryptonote KV_SERIALIZE(version) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_STOP_MINING { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -996,20 +1033,22 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_MINING_STATUS { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; bool active; @@ -1027,20 +1066,22 @@ namespace cryptonote KV_SERIALIZE(is_background_mining_enabled) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //----------------------------------------------- struct COMMAND_RPC_SAVE_BC { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1048,6 +1089,7 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; // @@ -1055,7 +1097,7 @@ namespace cryptonote { typedef std::list request; - struct response + struct response_t { uint64_t count; std::string status; @@ -1065,7 +1107,7 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; - + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GETBLOCKHASH @@ -1078,7 +1120,7 @@ namespace cryptonote struct COMMAND_RPC_GETBLOCKTEMPLATE { - struct request + struct request_t { uint64_t reserve_size; //max 255 bytes std::string wallet_address; @@ -1088,8 +1130,9 @@ namespace cryptonote KV_SERIALIZE(wallet_address) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t difficulty; uint64_t height; @@ -1113,13 +1156,14 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SUBMITBLOCK { typedef std::vector request; - struct response + struct response_t { std::string status; @@ -1127,11 +1171,12 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GENERATEBLOCKS { - struct request + struct request_t { uint64_t amount_of_blocks; std::string wallet_address; @@ -1141,8 +1186,9 @@ namespace cryptonote KV_SERIALIZE(wallet_address) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t height; std::string status; @@ -1152,6 +1198,7 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct block_header_response @@ -1197,7 +1244,7 @@ namespace cryptonote struct COMMAND_RPC_GET_LAST_BLOCK_HEADER { - struct request + struct request_t { bool fill_pow_hash; @@ -1205,8 +1252,9 @@ namespace cryptonote KV_SERIALIZE_OPT(fill_pow_hash, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; block_header_response block_header; @@ -1218,12 +1266,13 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_BLOCK_HEADER_BY_HASH { - struct request + struct request_t { std::string hash; bool fill_pow_hash; @@ -1233,8 +1282,9 @@ namespace cryptonote KV_SERIALIZE_OPT(fill_pow_hash, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; block_header_response block_header; @@ -1246,12 +1296,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; - + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT { - struct request + struct request_t { uint64_t height; bool fill_pow_hash; @@ -1261,8 +1311,9 @@ namespace cryptonote KV_SERIALIZE_OPT(fill_pow_hash, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; block_header_response block_header; @@ -1274,12 +1325,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; - + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_BLOCK { - struct request + struct request_t { std::string hash; uint64_t height; @@ -1291,8 +1342,9 @@ namespace cryptonote KV_SERIALIZE_OPT(fill_pow_hash, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; block_header_response block_header; @@ -1312,7 +1364,7 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; - + typedef epee::misc_utils::struct_init response; }; struct peer { @@ -1344,13 +1396,14 @@ namespace cryptonote struct COMMAND_RPC_GET_PEER_LIST { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::vector white_list; @@ -1362,11 +1415,12 @@ namespace cryptonote KV_SERIALIZE(gray_list) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SET_LOG_HASH_RATE { - struct request + struct request_t { bool visible; @@ -1374,19 +1428,21 @@ namespace cryptonote KV_SERIALIZE(visible) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SET_LOG_LEVEL { - struct request + struct request_t { int8_t level; @@ -1394,19 +1450,21 @@ namespace cryptonote KV_SERIALIZE(level) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SET_LOG_CATEGORIES { - struct request + struct request_t { std::string categories; @@ -1414,8 +1472,9 @@ namespace cryptonote KV_SERIALIZE(categories) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::string categories; @@ -1425,6 +1484,7 @@ namespace cryptonote KV_SERIALIZE(categories) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct tx_info @@ -1479,13 +1539,14 @@ namespace cryptonote struct COMMAND_RPC_GET_TRANSACTION_POOL { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::vector transactions; @@ -1499,17 +1560,19 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_TRANSACTION_POOL_HASHES_BIN { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::vector tx_hashes; @@ -1521,17 +1584,19 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_TRANSACTION_POOL_HASHES { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::vector tx_hashes; @@ -1543,6 +1608,7 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct tx_backlog_entry @@ -1554,13 +1620,14 @@ namespace cryptonote struct COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::vector backlog; @@ -1572,6 +1639,7 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct txpool_histo @@ -1622,13 +1690,14 @@ namespace cryptonote struct COMMAND_RPC_GET_TRANSACTION_POOL_STATS { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; txpool_stats pool_stats; @@ -1640,17 +1709,19 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_CONNECTIONS { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::list connections; @@ -1660,12 +1731,12 @@ namespace cryptonote KV_SERIALIZE(connections) END_KV_SERIALIZE_MAP() }; - + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_BLOCK_HEADERS_RANGE { - struct request + struct request_t { uint64_t start_height; uint64_t end_height; @@ -1677,8 +1748,9 @@ namespace cryptonote KV_SERIALIZE_OPT(fill_pow_hash, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::vector headers; @@ -1690,17 +1762,19 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_STOP_DAEMON { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1708,17 +1782,19 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_FAST_EXIT { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1726,17 +1802,19 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_LIMIT { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; uint64_t limit_up; @@ -1750,11 +1828,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SET_LIMIT { - struct request + struct request_t { int64_t limit_down; // all limits (for get and set) are kB/s int64_t limit_up; @@ -1764,8 +1843,9 @@ namespace cryptonote KV_SERIALIZE(limit_up) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; int64_t limit_up; @@ -1777,19 +1857,21 @@ namespace cryptonote KV_SERIALIZE(limit_down) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_OUT_PEERS { - struct request + struct request_t { uint64_t out_peers; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(out_peers) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1797,19 +1879,21 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_IN_PEERS { - struct request + struct request_t { uint64_t in_peers; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(in_peers) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1817,17 +1901,19 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_START_SAVE_GRAPH { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1835,17 +1921,19 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_STOP_SAVE_GRAPH { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1853,11 +1941,12 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_HARD_FORK_INFO { - struct request + struct request_t { uint8_t version; @@ -1865,8 +1954,9 @@ namespace cryptonote KV_SERIALIZE(version) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint8_t version; bool enabled; @@ -1892,6 +1982,7 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GETBANS @@ -1909,13 +2000,14 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; std::vector bans; @@ -1925,6 +2017,7 @@ namespace cryptonote KV_SERIALIZE(bans) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SETBANS @@ -1944,7 +2037,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct request + struct request_t { std::vector bans; @@ -1952,8 +2045,9 @@ namespace cryptonote KV_SERIALIZE(bans) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1961,11 +2055,12 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_FLUSH_TRANSACTION_POOL { - struct request + struct request_t { std::vector txids; @@ -1973,8 +2068,9 @@ namespace cryptonote KV_SERIALIZE(txids) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -1982,11 +2078,12 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_OUTPUT_HISTOGRAM { - struct request + struct request_t { std::vector amounts; uint64_t min_count; @@ -2002,6 +2099,7 @@ namespace cryptonote KV_SERIALIZE(recent_cutoff); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct entry { @@ -2022,7 +2120,7 @@ namespace cryptonote entry() {} }; - struct response + struct response_t { std::string status; std::vector histogram; @@ -2034,17 +2132,19 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_VERSION { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; uint32_t version; @@ -2056,11 +2156,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_COINBASE_TX_SUM { - struct request + struct request_t { uint64_t height; uint64_t count; @@ -2070,8 +2171,9 @@ namespace cryptonote KV_SERIALIZE(count); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; uint64_t emission_amount; @@ -2083,11 +2185,12 @@ namespace cryptonote KV_SERIALIZE(fee_amount) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_BASE_FEE_ESTIMATE { - struct request + struct request_t { uint64_t grace_blocks; @@ -2095,8 +2198,9 @@ namespace cryptonote KV_SERIALIZE(grace_blocks) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; uint64_t fee; @@ -2110,15 +2214,17 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_ALTERNATE_CHAINS { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct chain_info { @@ -2139,7 +2245,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::string status; std::list chains; @@ -2149,11 +2255,12 @@ namespace cryptonote KV_SERIALIZE(chains) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_UPDATE { - struct request + struct request_t { std::string command; std::string path; @@ -2163,8 +2270,9 @@ namespace cryptonote KV_SERIALIZE(path); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; bool update; @@ -2184,11 +2292,12 @@ namespace cryptonote KV_SERIALIZE(path) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_RELAY_TX { - struct request + struct request_t { std::vector txids; @@ -2196,8 +2305,9 @@ namespace cryptonote KV_SERIALIZE(txids) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; @@ -2205,15 +2315,17 @@ namespace cryptonote KV_SERIALIZE(status) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SYNC_INFO { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct peer { @@ -2245,7 +2357,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::string status; uint64_t height; @@ -2265,11 +2377,12 @@ namespace cryptonote KV_SERIALIZE(overview) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_OUTPUT_DISTRIBUTION { - struct request + struct request_t { std::vector amounts; uint64_t from_height; @@ -2287,6 +2400,7 @@ namespace cryptonote KV_SERIALIZE_OPT(compress, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct distribution { @@ -2330,7 +2444,7 @@ namespace cryptonote END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::string status; std::vector distributions; @@ -2342,11 +2456,12 @@ namespace cryptonote KV_SERIALIZE(untrusted) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_POP_BLOCKS { - struct request + struct request_t { uint64_t nblocks; @@ -2354,8 +2469,9 @@ namespace cryptonote KV_SERIALIZE(nblocks); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string status; uint64_t height; @@ -2365,11 +2481,12 @@ namespace cryptonote KV_SERIALIZE(height) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_PRUNE_BLOCKCHAIN { - struct request + struct request_t { bool check; @@ -2377,8 +2494,9 @@ namespace cryptonote KV_SERIALIZE_OPT(check, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint32_t pruning_seed; std::string status; @@ -2388,6 +2506,7 @@ namespace cryptonote KV_SERIALIZE(pruning_seed) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; } diff --git a/src/wallet/message_transporter.cpp b/src/wallet/message_transporter.cpp index eafd13d3b..19bfa074d 100644 --- a/src/wallet/message_transporter.cpp +++ b/src/wallet/message_transporter.cpp @@ -44,7 +44,7 @@ namespace mms namespace bitmessage_rpc { - struct message_info + struct message_info_t { uint32_t encodingType; std::string toAddress; @@ -66,8 +66,9 @@ namespace bitmessage_rpc KV_SERIALIZE(subject) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init message_info; - struct inbox_messages_response + struct inbox_messages_response_t { std::vector inboxMessages; @@ -75,6 +76,7 @@ namespace bitmessage_rpc KV_SERIALIZE(inboxMessages) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init inbox_messages_response; } diff --git a/src/wallet/message_transporter.h b/src/wallet/message_transporter.h index 8291311ce..736fc9b63 100644 --- a/src/wallet/message_transporter.h +++ b/src/wallet/message_transporter.h @@ -42,7 +42,7 @@ namespace mms { -struct transport_message +struct transport_message_t { cryptonote::account_public_address source_monero_address; std::string source_transport_address; @@ -78,6 +78,7 @@ struct transport_message KV_SERIALIZE(transport_id) END_KV_SERIALIZE_MAP() }; +typedef epee::misc_utils::struct_init transport_message; class message_transporter { diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h index c450b2b37..546e572bc 100644 --- a/src/wallet/wallet_rpc_server_commands_defs.h +++ b/src/wallet/wallet_rpc_server_commands_defs.h @@ -59,7 +59,7 @@ namespace wallet_rpc struct COMMAND_RPC_GET_BALANCE { - struct request + struct request_t { uint32_t account_index; std::set address_indices; @@ -70,6 +70,7 @@ namespace wallet_rpc KV_SERIALIZE_OPT(all_accounts, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct per_subaddress_info { @@ -92,7 +93,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { uint64_t balance; uint64_t unlocked_balance; @@ -106,11 +107,12 @@ namespace wallet_rpc KV_SERIALIZE(per_subaddress) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_ADDRESS { - struct request + struct request_t { uint32_t account_index; std::vector address_index; @@ -119,6 +121,7 @@ namespace wallet_rpc KV_SERIALIZE(address_index) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct address_info { @@ -135,7 +138,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::string address; // to remain compatible with older RPC format std::vector addresses; @@ -145,30 +148,33 @@ namespace wallet_rpc KV_SERIALIZE(addresses) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_ADDRESS_INDEX { - struct request + struct request_t { std::string address; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(address) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { cryptonote::subaddress_index index; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(index) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CREATE_ADDRESS { - struct request + struct request_t { uint32_t account_index; std::string label; @@ -178,8 +184,9 @@ namespace wallet_rpc KV_SERIALIZE(label) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string address; uint32_t address_index; @@ -189,11 +196,12 @@ namespace wallet_rpc KV_SERIALIZE(address_index) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_LABEL_ADDRESS { - struct request + struct request_t { cryptonote::subaddress_index index; std::string label; @@ -203,17 +211,19 @@ namespace wallet_rpc KV_SERIALIZE(label) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_ACCOUNTS { - struct request + struct request_t { std::string tag; // all accounts if empty, otherwise those accounts with this tag @@ -221,6 +231,7 @@ namespace wallet_rpc KV_SERIALIZE(tag) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct subaddress_account_info { @@ -241,7 +252,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { uint64_t total_balance; uint64_t total_unlocked_balance; @@ -253,19 +264,21 @@ namespace wallet_rpc KV_SERIALIZE(subaddress_accounts) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CREATE_ACCOUNT { - struct request + struct request_t { std::string label; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(label) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint32_t account_index; std::string address; // the 0-th address for convenience @@ -274,11 +287,12 @@ namespace wallet_rpc KV_SERIALIZE(address) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_LABEL_ACCOUNT { - struct request + struct request_t { uint32_t account_index; std::string label; @@ -288,21 +302,24 @@ namespace wallet_rpc KV_SERIALIZE(label) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_ACCOUNT_TAGS { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct account_tag_info { @@ -317,7 +334,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::vector account_tags; @@ -325,11 +342,12 @@ namespace wallet_rpc KV_SERIALIZE(account_tags) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_TAG_ACCOUNTS { - struct request + struct request_t { std::string tag; std::set accounts; @@ -339,17 +357,19 @@ namespace wallet_rpc KV_SERIALIZE(accounts) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_UNTAG_ACCOUNTS { - struct request + struct request_t { std::set accounts; @@ -357,17 +377,19 @@ namespace wallet_rpc KV_SERIALIZE(accounts) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SET_ACCOUNT_TAG_DESCRIPTION { - struct request + struct request_t { std::string tag; std::string description; @@ -377,29 +399,33 @@ namespace wallet_rpc KV_SERIALIZE(description) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_HEIGHT { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t height; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(height) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct transfer_destination @@ -414,7 +440,7 @@ namespace wallet_rpc struct COMMAND_RPC_TRANSFER { - struct request + struct request_t { std::list destinations; uint32_t account_index; @@ -444,8 +470,9 @@ namespace wallet_rpc KV_SERIALIZE_OPT(get_tx_metadata, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string tx_hash; std::string tx_key; @@ -467,11 +494,12 @@ namespace wallet_rpc KV_SERIALIZE(unsigned_txset) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_TRANSFER_SPLIT { - struct request + struct request_t { std::list destinations; uint32_t account_index; @@ -501,6 +529,7 @@ namespace wallet_rpc KV_SERIALIZE_OPT(get_tx_metadata, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct key_list { @@ -511,7 +540,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::list tx_hash_list; std::list tx_key_list; @@ -533,6 +562,7 @@ namespace wallet_rpc KV_SERIALIZE(unsigned_txset) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_DESCRIBE_TRANSFER @@ -577,7 +607,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct request + struct request_t { std::string unsigned_txset; @@ -585,8 +615,9 @@ namespace wallet_rpc KV_SERIALIZE(unsigned_txset) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::list desc; @@ -594,11 +625,12 @@ namespace wallet_rpc KV_SERIALIZE(desc) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SIGN_TRANSFER { - struct request + struct request_t { std::string unsigned_txset; bool export_raw; @@ -610,8 +642,9 @@ namespace wallet_rpc KV_SERIALIZE_OPT(get_tx_keys, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string signed_txset; std::list tx_hash_list; @@ -625,11 +658,12 @@ namespace wallet_rpc KV_SERIALIZE(tx_key_list) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SUBMIT_TRANSFER { - struct request + struct request_t { std::string tx_data_hex; @@ -637,8 +671,9 @@ namespace wallet_rpc KV_SERIALIZE(tx_data_hex) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::list tx_hash_list; @@ -646,11 +681,12 @@ namespace wallet_rpc KV_SERIALIZE(tx_hash_list) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SWEEP_DUST { - struct request + struct request_t { bool get_tx_keys; bool do_not_relay; @@ -664,6 +700,7 @@ namespace wallet_rpc KV_SERIALIZE_OPT(get_tx_metadata, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct key_list { @@ -674,7 +711,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::list tx_hash_list; std::list tx_key_list; @@ -696,11 +733,12 @@ namespace wallet_rpc KV_SERIALIZE(unsigned_txset) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SWEEP_ALL { - struct request + struct request_t { std::string address; uint32_t account_index; @@ -734,6 +772,7 @@ namespace wallet_rpc KV_SERIALIZE_OPT(get_tx_metadata, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct key_list { @@ -744,7 +783,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::list tx_hash_list; std::list tx_key_list; @@ -766,11 +805,12 @@ namespace wallet_rpc KV_SERIALIZE(unsigned_txset) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SWEEP_SINGLE { - struct request + struct request_t { std::string address; uint32_t priority; @@ -800,8 +840,9 @@ namespace wallet_rpc KV_SERIALIZE_OPT(get_tx_metadata, false) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string tx_hash; std::string tx_key; @@ -823,11 +864,12 @@ namespace wallet_rpc KV_SERIALIZE(unsigned_txset) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_RELAY_TX { - struct request + struct request_t { std::string hex; @@ -835,8 +877,9 @@ namespace wallet_rpc KV_SERIALIZE(hex) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string tx_hash; @@ -844,21 +887,24 @@ namespace wallet_rpc KV_SERIALIZE(tx_hash) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_STORE { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct payment_details @@ -884,7 +930,7 @@ namespace wallet_rpc struct COMMAND_RPC_GET_PAYMENTS { - struct request + struct request_t { std::string payment_id; @@ -892,8 +938,9 @@ namespace wallet_rpc KV_SERIALIZE(payment_id) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::list payments; @@ -901,11 +948,12 @@ namespace wallet_rpc KV_SERIALIZE(payments) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_BULK_PAYMENTS { - struct request + struct request_t { std::vector payment_ids; uint64_t min_block_height; @@ -915,8 +963,9 @@ namespace wallet_rpc KV_SERIALIZE(min_block_height) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::list payments; @@ -924,6 +973,7 @@ namespace wallet_rpc KV_SERIALIZE(payments) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct transfer_details @@ -947,7 +997,7 @@ namespace wallet_rpc struct COMMAND_RPC_INCOMING_TRANSFERS { - struct request + struct request_t { std::string transfer_type; uint32_t account_index; @@ -959,8 +1009,9 @@ namespace wallet_rpc KV_SERIALIZE(subaddr_indices) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::list transfers; @@ -968,12 +1019,13 @@ namespace wallet_rpc KV_SERIALIZE(transfers) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; //JSON RPC V2 struct COMMAND_RPC_QUERY_KEY { - struct request + struct request_t { std::string key_type; @@ -981,8 +1033,9 @@ namespace wallet_rpc KV_SERIALIZE(key_type) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string key; @@ -990,11 +1043,12 @@ namespace wallet_rpc KV_SERIALIZE(key) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_MAKE_INTEGRATED_ADDRESS { - struct request + struct request_t { std::string standard_address; std::string payment_id; @@ -1004,8 +1058,9 @@ namespace wallet_rpc KV_SERIALIZE(payment_id) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string integrated_address; std::string payment_id; @@ -1015,11 +1070,12 @@ namespace wallet_rpc KV_SERIALIZE(payment_id) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS { - struct request + struct request_t { std::string integrated_address; @@ -1027,8 +1083,9 @@ namespace wallet_rpc KV_SERIALIZE(integrated_address) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string standard_address; std::string payment_id; @@ -1040,26 +1097,29 @@ namespace wallet_rpc KV_SERIALIZE(is_subaddress) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_STOP_WALLET { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_RESCAN_BLOCKCHAIN { - struct request + struct request_t { bool hard; @@ -1067,17 +1127,19 @@ namespace wallet_rpc KV_SERIALIZE_OPT(hard, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SET_TX_NOTES { - struct request + struct request_t { std::list txids; std::list notes; @@ -1087,17 +1149,19 @@ namespace wallet_rpc KV_SERIALIZE(notes) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_TX_NOTES { - struct request + struct request_t { std::list txids; @@ -1105,8 +1169,9 @@ namespace wallet_rpc KV_SERIALIZE(txids) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::list notes; @@ -1114,11 +1179,12 @@ namespace wallet_rpc KV_SERIALIZE(notes) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SET_ATTRIBUTE { - struct request + struct request_t { std::string key; std::string value; @@ -1128,17 +1194,19 @@ namespace wallet_rpc KV_SERIALIZE(value) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_ATTRIBUTE { - struct request + struct request_t { std::string key; @@ -1147,8 +1215,9 @@ namespace wallet_rpc KV_SERIALIZE(key) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string value; @@ -1156,11 +1225,12 @@ namespace wallet_rpc KV_SERIALIZE(value) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_TX_KEY { - struct request + struct request_t { std::string txid; @@ -1168,8 +1238,9 @@ namespace wallet_rpc KV_SERIALIZE(txid) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string tx_key; @@ -1177,11 +1248,12 @@ namespace wallet_rpc KV_SERIALIZE(tx_key) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CHECK_TX_KEY { - struct request + struct request_t { std::string txid; std::string tx_key; @@ -1193,8 +1265,9 @@ namespace wallet_rpc KV_SERIALIZE(address) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t received; bool in_pool; @@ -1206,11 +1279,12 @@ namespace wallet_rpc KV_SERIALIZE(confirmations) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_TX_PROOF { - struct request + struct request_t { std::string txid; std::string address; @@ -1222,8 +1296,9 @@ namespace wallet_rpc KV_SERIALIZE(message) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string signature; @@ -1231,11 +1306,12 @@ namespace wallet_rpc KV_SERIALIZE(signature) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CHECK_TX_PROOF { - struct request + struct request_t { std::string txid; std::string address; @@ -1249,8 +1325,9 @@ namespace wallet_rpc KV_SERIALIZE(signature) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { bool good; uint64_t received; @@ -1264,6 +1341,7 @@ namespace wallet_rpc KV_SERIALIZE(confirmations) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct transfer_entry @@ -1305,7 +1383,7 @@ namespace wallet_rpc struct COMMAND_RPC_GET_SPEND_PROOF { - struct request + struct request_t { std::string txid; std::string message; @@ -1315,8 +1393,9 @@ namespace wallet_rpc KV_SERIALIZE(message) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string signature; @@ -1324,11 +1403,12 @@ namespace wallet_rpc KV_SERIALIZE(signature) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CHECK_SPEND_PROOF { - struct request + struct request_t { std::string txid; std::string message; @@ -1340,8 +1420,9 @@ namespace wallet_rpc KV_SERIALIZE(signature) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { bool good; @@ -1349,11 +1430,12 @@ namespace wallet_rpc KV_SERIALIZE(good) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_RESERVE_PROOF { - struct request + struct request_t { bool all; uint32_t account_index; // ignored when `all` is true @@ -1367,8 +1449,9 @@ namespace wallet_rpc KV_SERIALIZE(message) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string signature; @@ -1376,11 +1459,12 @@ namespace wallet_rpc KV_SERIALIZE(signature) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CHECK_RESERVE_PROOF { - struct request + struct request_t { std::string address; std::string message; @@ -1392,8 +1476,9 @@ namespace wallet_rpc KV_SERIALIZE(signature) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { bool good; uint64_t total; @@ -1405,11 +1490,12 @@ namespace wallet_rpc KV_SERIALIZE(spent) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_TRANSFERS { - struct request + struct request_t { bool in; bool out; @@ -1438,8 +1524,9 @@ namespace wallet_rpc KV_SERIALIZE_OPT(all_accounts, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::list in; std::list out; @@ -1455,11 +1542,12 @@ namespace wallet_rpc KV_SERIALIZE(pool); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_TRANSFER_BY_TXID { - struct request + struct request_t { std::string txid; uint32_t account_index; @@ -1469,8 +1557,9 @@ namespace wallet_rpc KV_SERIALIZE_OPT(account_index, (uint32_t)0) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { transfer_entry transfer; std::list transfers; @@ -1480,11 +1569,12 @@ namespace wallet_rpc KV_SERIALIZE(transfers); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SIGN { - struct request + struct request_t { std::string data; @@ -1492,8 +1582,9 @@ namespace wallet_rpc KV_SERIALIZE(data); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string signature; @@ -1501,11 +1592,12 @@ namespace wallet_rpc KV_SERIALIZE(signature); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_VERIFY { - struct request + struct request_t { std::string data; std::string address; @@ -1517,8 +1609,9 @@ namespace wallet_rpc KV_SERIALIZE(signature); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { bool good; @@ -1526,17 +1619,19 @@ namespace wallet_rpc KV_SERIALIZE(good); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_EXPORT_OUTPUTS { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string outputs_data_hex; @@ -1544,11 +1639,12 @@ namespace wallet_rpc KV_SERIALIZE(outputs_data_hex); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_IMPORT_OUTPUTS { - struct request + struct request_t { std::string outputs_data_hex; @@ -1556,8 +1652,9 @@ namespace wallet_rpc KV_SERIALIZE(outputs_data_hex); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t num_imported; @@ -1565,11 +1662,12 @@ namespace wallet_rpc KV_SERIALIZE(num_imported); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_EXPORT_KEY_IMAGES { - struct request + struct request_t { bool all; @@ -1577,6 +1675,7 @@ namespace wallet_rpc KV_SERIALIZE_OPT(all, false); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct signed_key_image { @@ -1589,7 +1688,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { uint32_t offset; std::vector signed_key_images; @@ -1599,6 +1698,7 @@ namespace wallet_rpc KV_SERIALIZE(signed_key_images); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_IMPORT_KEY_IMAGES @@ -1614,7 +1714,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct request + struct request_t { uint32_t offset; std::vector signed_key_images; @@ -1624,8 +1724,9 @@ namespace wallet_rpc KV_SERIALIZE(signed_key_images); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t height; uint64_t spent; @@ -1637,6 +1738,7 @@ namespace wallet_rpc KV_SERIALIZE(unspent) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct uri_spec @@ -1658,11 +1760,12 @@ namespace wallet_rpc struct COMMAND_RPC_MAKE_URI { - struct request: public uri_spec + struct request_t: public uri_spec { }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string uri; @@ -1670,11 +1773,12 @@ namespace wallet_rpc KV_SERIALIZE(uri) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_PARSE_URI { - struct request + struct request_t { std::string uri; @@ -1682,8 +1786,9 @@ namespace wallet_rpc KV_SERIALIZE(uri) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uri_spec uri; std::vector unknown_parameters; @@ -1693,11 +1798,12 @@ namespace wallet_rpc KV_SERIALIZE(unknown_parameters); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_ADD_ADDRESS_BOOK_ENTRY { - struct request + struct request_t { std::string address; std::string payment_id; @@ -1709,8 +1815,9 @@ namespace wallet_rpc KV_SERIALIZE(description) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t index; @@ -1718,11 +1825,12 @@ namespace wallet_rpc KV_SERIALIZE(index); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY { - struct request + struct request_t { std::list entries; @@ -1730,6 +1838,7 @@ namespace wallet_rpc KV_SERIALIZE(entries) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; struct entry { @@ -1746,7 +1855,7 @@ namespace wallet_rpc END_KV_SERIALIZE_MAP() }; - struct response + struct response_t { std::vector entries; @@ -1754,11 +1863,12 @@ namespace wallet_rpc KV_SERIALIZE(entries) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_DELETE_ADDRESS_BOOK_ENTRY { - struct request + struct request_t { uint64_t index; @@ -1766,32 +1876,36 @@ namespace wallet_rpc KV_SERIALIZE(index); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_RESCAN_SPENT { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_REFRESH { - struct request + struct request_t { uint64_t start_height; @@ -1799,8 +1913,9 @@ namespace wallet_rpc KV_SERIALIZE_OPT(start_height, (uint64_t) 0) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t blocks_fetched; bool received_money; @@ -1810,11 +1925,12 @@ namespace wallet_rpc KV_SERIALIZE(received_money); END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_START_MINING { - struct request + struct request_t { uint64_t threads_count; bool do_background_mining; @@ -1826,37 +1942,43 @@ namespace wallet_rpc KV_SERIALIZE(ignore_battery) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_STOP_MINING { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_LANGUAGES { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; - struct response + typedef epee::misc_utils::struct_init request; + + struct response_t { std::vector languages; @@ -1864,11 +1986,12 @@ namespace wallet_rpc KV_SERIALIZE(languages) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CREATE_WALLET { - struct request + struct request_t { std::string filename; std::string password; @@ -1880,16 +2003,19 @@ namespace wallet_rpc KV_SERIALIZE(language) END_KV_SERIALIZE_MAP() }; - struct response + typedef epee::misc_utils::struct_init request; + + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_OPEN_WALLET { - struct request + struct request_t { std::string filename; std::string password; @@ -1899,31 +2025,36 @@ namespace wallet_rpc KV_SERIALIZE(password) END_KV_SERIALIZE_MAP() }; - struct response + typedef epee::misc_utils::struct_init request; + + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CLOSE_WALLET { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_CHANGE_WALLET_PASSWORD { - struct request + struct request_t { std::string old_password; std::string new_password; @@ -1933,16 +2064,19 @@ namespace wallet_rpc KV_SERIALIZE(new_password) END_KV_SERIALIZE_MAP() }; - struct response + typedef epee::misc_utils::struct_init request; + + struct response_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_RESTORE_DETERMINISTIC_WALLET { - struct request + struct request_t { uint64_t restore_height; std::string filename; @@ -1960,8 +2094,9 @@ namespace wallet_rpc KV_SERIALIZE(language) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string address; std::string seed; @@ -1975,17 +2110,19 @@ namespace wallet_rpc KV_SERIALIZE(was_deprecated) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_IS_MULTISIG { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { bool multisig; bool ready; @@ -1999,17 +2136,19 @@ namespace wallet_rpc KV_SERIALIZE(total) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_PREPARE_MULTISIG { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string multisig_info; @@ -2017,11 +2156,12 @@ namespace wallet_rpc KV_SERIALIZE(multisig_info) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_MAKE_MULTISIG { - struct request + struct request_t { std::vector multisig_info; uint32_t threshold; @@ -2033,8 +2173,9 @@ namespace wallet_rpc KV_SERIALIZE(password) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string address; std::string multisig_info; @@ -2044,17 +2185,19 @@ namespace wallet_rpc KV_SERIALIZE(multisig_info) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_EXPORT_MULTISIG { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string info; @@ -2062,11 +2205,12 @@ namespace wallet_rpc KV_SERIALIZE(info) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_IMPORT_MULTISIG { - struct request + struct request_t { std::vector info; @@ -2074,8 +2218,9 @@ namespace wallet_rpc KV_SERIALIZE(info) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint64_t n_outputs; @@ -2083,11 +2228,12 @@ namespace wallet_rpc KV_SERIALIZE(n_outputs) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_FINALIZE_MULTISIG { - struct request + struct request_t { std::string password; std::vector multisig_info; @@ -2097,8 +2243,9 @@ namespace wallet_rpc KV_SERIALIZE(multisig_info) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string address; @@ -2106,11 +2253,12 @@ namespace wallet_rpc KV_SERIALIZE(address) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_EXCHANGE_MULTISIG_KEYS { - struct request + struct request_t { std::string password; std::vector multisig_info; @@ -2120,8 +2268,9 @@ namespace wallet_rpc KV_SERIALIZE(multisig_info) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string address; std::string multisig_info; @@ -2131,11 +2280,12 @@ namespace wallet_rpc KV_SERIALIZE(multisig_info) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SIGN_MULTISIG { - struct request + struct request_t { std::string tx_data_hex; @@ -2143,8 +2293,9 @@ namespace wallet_rpc KV_SERIALIZE(tx_data_hex) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::string tx_data_hex; std::list tx_hash_list; @@ -2154,11 +2305,12 @@ namespace wallet_rpc KV_SERIALIZE(tx_hash_list) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_SUBMIT_MULTISIG { - struct request + struct request_t { std::string tx_data_hex; @@ -2166,8 +2318,9 @@ namespace wallet_rpc KV_SERIALIZE(tx_data_hex) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { std::list tx_hash_list; @@ -2175,17 +2328,19 @@ namespace wallet_rpc KV_SERIALIZE(tx_hash_list) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_GET_VERSION { - struct request + struct request_t { BEGIN_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init request; - struct response + struct response_t { uint32_t version; @@ -2193,6 +2348,7 @@ namespace wallet_rpc KV_SERIALIZE(version) END_KV_SERIALIZE_MAP() }; + typedef epee::misc_utils::struct_init response; }; struct COMMAND_RPC_VALIDATE_ADDRESS From 23abe60705a7b1040d177478a3ff1403d1fe0ef4 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 19 Jan 2019 13:02:47 +0000 Subject: [PATCH 3/3] check load_t_from_json return values --- src/cryptonote_basic/miner.cpp | 3 ++- src/wallet/message_transporter.cpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp index d29a3dcd6..3a51c6ea4 100644 --- a/src/cryptonote_basic/miner.cpp +++ b/src/cryptonote_basic/miner.cpp @@ -305,7 +305,8 @@ namespace cryptonote } m_config_folder_path = boost::filesystem::path(command_line::get_arg(vm, arg_extra_messages)).parent_path().string(); m_config = AUTO_VAL_INIT(m_config); - epee::serialization::load_t_from_json_file(m_config, m_config_folder_path + "/" + MINER_CONFIG_FILE_NAME); + const std::string filename = m_config_folder_path + "/" + MINER_CONFIG_FILE_NAME; + CHECK_AND_ASSERT_MES(epee::serialization::load_t_from_json_file(m_config, filename), false, "Failed to load data from " << filename); MINFO("Loaded " << m_extra_messages.size() << " extra messages, current index " << m_config.current_extra_message_index); } diff --git a/src/wallet/message_transporter.cpp b/src/wallet/message_transporter.cpp index 19bfa074d..2f8188a3c 100644 --- a/src/wallet/message_transporter.cpp +++ b/src/wallet/message_transporter.cpp @@ -118,7 +118,11 @@ bool message_transporter::receive_messages(const std::vector &desti std::string json = get_str_between_tags(answer, "", ""); bitmessage_rpc::inbox_messages_response bitmessage_res; - epee::serialization::load_t_from_json(bitmessage_res, json); + if (!epee::serialization::load_t_from_json(bitmessage_res, json)) + { + MERROR("Failed to deserialize messages"); + return true; + } size_t size = bitmessage_res.inboxMessages.size(); messages.clear(); @@ -140,8 +144,10 @@ bool message_transporter::receive_messages(const std::vector &desti std::string message_body = epee::string_encoding::base64_decode(message_info.message); // Second Base64-decoding: The MMS uses Base64 to hide non-textual data in its JSON from Bitmessage json = epee::string_encoding::base64_decode(message_body); - epee::serialization::load_t_from_json(message, json); - is_mms_message = true; + if (!epee::serialization::load_t_from_json(message, json)) + MERROR("Failed to deserialize message"); + else + is_mms_message = true; } catch(const std::exception& e) {