Merge pull request #5101

23abe607 check load_t_from_json return values (moneromooo-monero)
e396146a default initialize rpc structures (moneromooo-monero)
ef93b099 various: remove unused variables (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2019-03-05 10:10:57 +02:00
commit 5fb4a9719c
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
20 changed files with 670 additions and 352 deletions

View File

@ -81,7 +81,7 @@ namespace demo
{ {
const static int ID = 1000; const static int ID = 1000;
struct request struct request_t
{ {
std::string example_string_data; std::string example_string_data;
some_test_data sub; some_test_data sub;
@ -91,9 +91,10 @@ namespace demo
KV_SERIALIZE(sub) KV_SERIALIZE(sub)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
bool m_success; bool m_success;
std::list<some_test_data> subs; std::list<some_test_data> subs;
@ -104,6 +105,7 @@ namespace demo
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
}; };
typedef epee::misc_utils::struct_init<response_t> response;
@ -111,7 +113,7 @@ namespace demo
{ {
const static int ID = 1001; const static int ID = 1001;
struct request struct request_t
{ {
std::string example_string_data2; std::string example_string_data2;
@ -119,8 +121,9 @@ namespace demo
KV_SERIALIZE(example_string_data2) KV_SERIALIZE(example_string_data2)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
bool m_success; bool m_success;
@ -129,6 +132,7 @@ namespace demo
KV_SERIALIZE(m_success) KV_SERIALIZE(m_success)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };

View File

@ -159,5 +159,10 @@ namespace misc_utils
return slc; return slc;
} }
template<typename T> struct struct_init: T
{
struct_init(): T{} {}
};
} }
} }

View File

@ -18,6 +18,8 @@ namespace epee
epee::serialization::storage_entry id; epee::serialization::storage_entry id;
t_param params; t_param params;
request(): id{}, params{} {}
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(jsonrpc) KV_SERIALIZE(jsonrpc)
KV_SERIALIZE(id) KV_SERIALIZE(id)
@ -30,6 +32,9 @@ namespace epee
{ {
int64_t code; int64_t code;
std::string message; std::string message;
error(): code(0) {}
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(code) KV_SERIALIZE(code)
KV_SERIALIZE(message) KV_SERIALIZE(message)
@ -55,6 +60,9 @@ namespace epee
t_param result; t_param result;
epee::serialization::storage_entry id; epee::serialization::storage_entry id;
t_error error; t_error error;
response(): result{}, id(), error{} {}
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(jsonrpc) KV_SERIALIZE(jsonrpc)
KV_SERIALIZE(id) KV_SERIALIZE(id)
@ -69,6 +77,9 @@ namespace epee
std::string jsonrpc; std::string jsonrpc;
t_param result; t_param result;
epee::serialization::storage_entry id; epee::serialization::storage_entry id;
response(): result{}, id{} {}
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(jsonrpc) KV_SERIALIZE(jsonrpc)
KV_SERIALIZE(id) KV_SERIALIZE(id)
@ -82,6 +93,9 @@ namespace epee
std::string jsonrpc; std::string jsonrpc;
t_error error; t_error error;
epee::serialization::storage_entry id; epee::serialization::storage_entry id;
response(): error{}, id{} {}
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(jsonrpc) KV_SERIALIZE(jsonrpc)
KV_SERIALIZE(id) KV_SERIALIZE(id)

View File

@ -62,7 +62,7 @@ namespace tests
{ {
const static int ID = 1000; const static int ID = 1000;
struct request struct request_t
{ {
std::string example_string_data; std::string example_string_data;
@ -75,9 +75,9 @@ namespace tests
SERIALIZE_T(sub) SERIALIZE_T(sub)
END_NAMED_SERIALIZE_MAP() END_NAMED_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response_t
struct response
{ {
bool m_success; bool m_success;
uint64_t example_id_data; uint64_t example_id_data;
@ -89,13 +89,14 @@ namespace tests
SERIALIZE_STL_CONTAINER_T(subs) SERIALIZE_STL_CONTAINER_T(subs)
END_NAMED_SERIALIZE_MAP() END_NAMED_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };
struct COMMAND_EXAMPLE_2 struct COMMAND_EXAMPLE_2
{ {
const static int ID = 1001; const static int ID = 1001;
struct request struct request_t
{ {
std::string example_string_data2; std::string example_string_data2;
uint64_t example_id_data; uint64_t example_id_data;
@ -105,8 +106,9 @@ namespace tests
SERIALIZE_STL_ANSI_STRING(example_string_data2) SERIALIZE_STL_ANSI_STRING(example_string_data2)
END_NAMED_SERIALIZE_MAP() END_NAMED_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
bool m_success; bool m_success;
uint64_t example_id_data; uint64_t example_id_data;
@ -116,6 +118,7 @@ namespace tests
SERIALIZE_POD(m_success) SERIALIZE_POD(m_success)
END_NAMED_SERIALIZE_MAP() END_NAMED_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };
typedef boost::uuids::uuid uuid; typedef boost::uuids::uuid uuid;

View File

@ -34,7 +34,7 @@
namespace cryptonote namespace cryptonote
{ {
struct core_stat_info struct core_stat_info_t
{ {
uint64_t tx_pool_size; uint64_t tx_pool_size;
uint64_t blockchain_height; uint64_t blockchain_height;
@ -50,4 +50,5 @@ namespace cryptonote
KV_SERIALIZE(top_block_id_str) KV_SERIALIZE(top_block_id_str)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<core_stat_info_t> core_stat_info;
} }

View File

@ -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_folder_path = boost::filesystem::path(command_line::get_arg(vm, arg_extra_messages)).parent_path().string();
m_config = AUTO_VAL_INIT(m_config); 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); MINFO("Loaded " << m_extra_messages.size() << " extra messages, current index " << m_config.current_extra_message_index);
} }

View File

@ -1746,7 +1746,6 @@ bool Blockchain::handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NO
for (auto& bl: blocks) for (auto& bl: blocks)
{ {
std::vector<crypto::hash> missed_tx_ids; std::vector<crypto::hash> missed_tx_ids;
std::vector<cryptonote::blobdata> txs;
rsp.blocks.push_back(block_complete_entry()); rsp.blocks.push_back(block_complete_entry());
block_complete_entry& e = rsp.blocks.back(); 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); e.block = std::move(bl.first);
} }
//get and pack other transactions, if needed //get and pack other transactions, if needed
std::vector<cryptonote::blobdata> txs;
get_transactions_blobs(arg.txs, rsp.txs, rsp.missed_ids); get_transactions_blobs(arg.txs, rsp.txs, rsp.missed_ids);
m_db->block_txn_stop(); m_db->block_txn_stop();

View File

@ -128,7 +128,7 @@ namespace cryptonote
{ {
const static int ID = BC_COMMANDS_POOL_BASE + 1; const static int ID = BC_COMMANDS_POOL_BASE + 1;
struct request struct request_t
{ {
block_complete_entry b; block_complete_entry b;
uint64_t current_blockchain_height; uint64_t current_blockchain_height;
@ -138,6 +138,7 @@ namespace cryptonote
KV_SERIALIZE(current_blockchain_height) KV_SERIALIZE(current_blockchain_height)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
}; };
/************************************************************************/ /************************************************************************/
@ -147,7 +148,7 @@ namespace cryptonote
{ {
const static int ID = BC_COMMANDS_POOL_BASE + 2; const static int ID = BC_COMMANDS_POOL_BASE + 2;
struct request struct request_t
{ {
std::vector<blobdata> txs; std::vector<blobdata> txs;
std::string _; // padding std::string _; // padding
@ -157,6 +158,7 @@ namespace cryptonote
KV_SERIALIZE(_) KV_SERIALIZE(_)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
}; };
/************************************************************************/ /************************************************************************/
/* */ /* */
@ -165,7 +167,7 @@ namespace cryptonote
{ {
const static int ID = BC_COMMANDS_POOL_BASE + 3; const static int ID = BC_COMMANDS_POOL_BASE + 3;
struct request struct request_t
{ {
std::vector<crypto::hash> txs; std::vector<crypto::hash> txs;
std::vector<crypto::hash> blocks; std::vector<crypto::hash> blocks;
@ -175,13 +177,14 @@ namespace cryptonote
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(blocks) KV_SERIALIZE_CONTAINER_POD_AS_BLOB(blocks)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
}; };
struct NOTIFY_RESPONSE_GET_OBJECTS struct NOTIFY_RESPONSE_GET_OBJECTS
{ {
const static int ID = BC_COMMANDS_POOL_BASE + 4; const static int ID = BC_COMMANDS_POOL_BASE + 4;
struct request struct request_t
{ {
std::vector<blobdata> txs; std::vector<blobdata> txs;
std::vector<block_complete_entry> blocks; std::vector<block_complete_entry> blocks;
@ -195,6 +198,7 @@ namespace cryptonote
KV_SERIALIZE(current_blockchain_height) KV_SERIALIZE(current_blockchain_height)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
}; };
@ -219,7 +223,7 @@ namespace cryptonote
{ {
const static int ID = BC_COMMANDS_POOL_BASE + 6; const static int ID = BC_COMMANDS_POOL_BASE + 6;
struct request struct request_t
{ {
std::list<crypto::hash> 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 */ std::list<crypto::hash> 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) KV_SERIALIZE_CONTAINER_POD_AS_BLOB(block_ids)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
}; };
struct NOTIFY_RESPONSE_CHAIN_ENTRY struct NOTIFY_RESPONSE_CHAIN_ENTRY
{ {
const static int ID = BC_COMMANDS_POOL_BASE + 7; const static int ID = BC_COMMANDS_POOL_BASE + 7;
struct request struct request_t
{ {
uint64_t start_height; uint64_t start_height;
uint64_t total_height; uint64_t total_height;
@ -247,6 +252,7 @@ namespace cryptonote
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_ids) KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_ids)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
}; };
/************************************************************************/ /************************************************************************/
@ -256,7 +262,7 @@ namespace cryptonote
{ {
const static int ID = BC_COMMANDS_POOL_BASE + 8; const static int ID = BC_COMMANDS_POOL_BASE + 8;
struct request struct request_t
{ {
block_complete_entry b; block_complete_entry b;
uint64_t current_blockchain_height; uint64_t current_blockchain_height;
@ -266,6 +272,7 @@ namespace cryptonote
KV_SERIALIZE(current_blockchain_height) KV_SERIALIZE(current_blockchain_height)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
}; };
/************************************************************************/ /************************************************************************/
@ -275,7 +282,7 @@ namespace cryptonote
{ {
const static int ID = BC_COMMANDS_POOL_BASE + 9; const static int ID = BC_COMMANDS_POOL_BASE + 9;
struct request struct request_t
{ {
crypto::hash block_hash; crypto::hash block_hash;
uint64_t current_blockchain_height; uint64_t current_blockchain_height;
@ -287,6 +294,7 @@ namespace cryptonote
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(missing_tx_indices) KV_SERIALIZE_CONTAINER_POD_AS_BLOB(missing_tx_indices)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
}; };
} }

View File

@ -275,7 +275,6 @@ namespace hw {
int device_ledger::set_command_header(unsigned char ins, unsigned char p1, unsigned char p2) { int device_ledger::set_command_header(unsigned char ins, unsigned char p1, unsigned char p2) {
reset_buffer(); reset_buffer();
int offset = 0;
this->buffer_send[0] = PROTOCOL_VERSION; this->buffer_send[0] = PROTOCOL_VERSION;
this->buffer_send[1] = ins; this->buffer_send[1] = ins;
this->buffer_send[2] = p1; 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) { bool device_ledger::verify_keys(const crypto::secret_key &secret_key, const crypto::public_key &public_key) {
AUTO_LOCK_CMD(); AUTO_LOCK_CMD();
int offset, sw; int offset;
offset = set_command_header_noopt(INS_VERIFY_KEY); offset = set_command_header_noopt(INS_VERIFY_KEY);
//sec //sec
@ -1567,7 +1566,6 @@ namespace hw {
bool device_ledger::mlsag_prepare(const rct::key &H, const rct::key &xx, 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) { rct::key &a, rct::key &aG, rct::key &aHP, rct::key &II) {
AUTO_LOCK_CMD(); AUTO_LOCK_CMD();
unsigned char options;
#ifdef DEBUG_HWDEVICE #ifdef DEBUG_HWDEVICE
const rct::key H_x = H; const rct::key H_x = H;
@ -1611,7 +1609,6 @@ namespace hw {
bool device_ledger::mlsag_prepare(rct::key &a, rct::key &aG) { bool device_ledger::mlsag_prepare(rct::key &a, rct::key &aG) {
AUTO_LOCK_CMD(); AUTO_LOCK_CMD();
unsigned char options;
#ifdef DEBUG_HWDEVICE #ifdef DEBUG_HWDEVICE
rct::key a_x; rct::key a_x;
@ -1634,7 +1631,6 @@ namespace hw {
bool device_ledger::mlsag_hash(const rct::keyV &long_message, rct::key &c) { bool device_ledger::mlsag_hash(const rct::keyV &long_message, rct::key &c) {
AUTO_LOCK_CMD(); AUTO_LOCK_CMD();
unsigned char options;
size_t cnt; size_t cnt;
#ifdef DEBUG_HWDEVICE #ifdef DEBUG_HWDEVICE

View File

@ -131,9 +131,9 @@ namespace nodetool
struct network_zone; struct network_zone;
using connect_func = boost::optional<p2p_connection_context>(network_zone&, epee::net_utils::network_address const&, epee::net_utils::ssl_support_t); using connect_func = boost::optional<p2p_connection_context>(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_net_config(),
m_peer_id(crypto::rand<uint64_t>()), m_peer_id(crypto::rand<uint64_t>()),
m_support_flags(0) m_support_flags(0)
@ -143,6 +143,7 @@ namespace nodetool
uint64_t m_peer_id; uint64_t m_peer_id;
uint32_t m_support_flags; uint32_t m_support_flags;
}; };
typedef epee::misc_utils::struct_init<config_t> config;
struct network_zone struct network_zone
{ {

View File

@ -179,7 +179,7 @@ namespace nodetool
{ {
const static int ID = P2P_COMMANDS_POOL_BASE + 1; const static int ID = P2P_COMMANDS_POOL_BASE + 1;
struct request struct request_t
{ {
basic_node_data node_data; basic_node_data node_data;
t_playload_type payload_data; t_playload_type payload_data;
@ -189,8 +189,9 @@ namespace nodetool
KV_SERIALIZE(payload_data) KV_SERIALIZE(payload_data)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
basic_node_data node_data; basic_node_data node_data;
t_playload_type payload_data; t_playload_type payload_data;
@ -230,7 +231,8 @@ namespace nodetool
} }
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
}; typedef epee::misc_utils::struct_init<response_t> response;
};
/************************************************************************/ /************************************************************************/
@ -241,15 +243,16 @@ namespace nodetool
{ {
const static int ID = P2P_COMMANDS_POOL_BASE + 2; const static int ID = P2P_COMMANDS_POOL_BASE + 2;
struct request struct request_t
{ {
t_playload_type payload_data; t_playload_type payload_data;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(payload_data) KV_SERIALIZE(payload_data)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
uint64_t local_time; uint64_t local_time;
t_playload_type payload_data; t_playload_type payload_data;
@ -289,6 +292,7 @@ namespace nodetool
} }
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };
/************************************************************************/ /************************************************************************/
@ -306,15 +310,16 @@ namespace nodetool
#define PING_OK_RESPONSE_STATUS_TEXT "OK" #define PING_OK_RESPONSE_STATUS_TEXT "OK"
struct request struct request_t
{ {
/*actually we don't need to send any real data*/ /*actually we don't need to send any real data*/
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
std::string status; std::string status;
peerid_type peer_id; peerid_type peer_id;
@ -324,6 +329,7 @@ namespace nodetool
KV_SERIALIZE(peer_id) KV_SERIALIZE(peer_id)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };
@ -350,15 +356,16 @@ namespace nodetool
{ {
const static int ID = P2P_COMMANDS_POOL_BASE + 4; const static int ID = P2P_COMMANDS_POOL_BASE + 4;
struct request struct request_t
{ {
proof_of_trust tr; proof_of_trust tr;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(tr) KV_SERIALIZE(tr)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
std::string version; std::string version;
std::string os_version; std::string os_version;
@ -374,6 +381,7 @@ namespace nodetool
KV_SERIALIZE(payload_info) KV_SERIALIZE(payload_info)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };
@ -384,15 +392,16 @@ namespace nodetool
{ {
const static int ID = P2P_COMMANDS_POOL_BASE + 5; const static int ID = P2P_COMMANDS_POOL_BASE + 5;
struct request struct request_t
{ {
proof_of_trust tr; proof_of_trust tr;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(tr) KV_SERIALIZE(tr)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
std::vector<peerlist_entry> local_peerlist_white; std::vector<peerlist_entry> local_peerlist_white;
std::vector<peerlist_entry> local_peerlist_gray; std::vector<peerlist_entry> local_peerlist_gray;
@ -407,6 +416,7 @@ namespace nodetool
KV_SERIALIZE(local_time) KV_SERIALIZE(local_time)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };
/************************************************************************/ /************************************************************************/
@ -416,13 +426,14 @@ namespace nodetool
{ {
const static int ID = P2P_COMMANDS_POOL_BASE + 6; const static int ID = P2P_COMMANDS_POOL_BASE + 6;
struct request struct request_t
{ {
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
peerid_type my_id; peerid_type my_id;
@ -430,6 +441,7 @@ namespace nodetool
KV_SERIALIZE(my_id) KV_SERIALIZE(my_id)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };
/************************************************************************/ /************************************************************************/
@ -439,13 +451,14 @@ namespace nodetool
{ {
const static int ID = P2P_COMMANDS_POOL_BASE + 7; const static int ID = P2P_COMMANDS_POOL_BASE + 7;
struct request struct request_t
{ {
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<request_t> request;
struct response struct response_t
{ {
uint32_t support_flags; uint32_t support_flags;
@ -453,6 +466,7 @@ namespace nodetool
KV_SERIALIZE(support_flags) KV_SERIALIZE(support_flags)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<response_t> response;
}; };
#endif #endif

View File

@ -469,7 +469,6 @@ namespace rct {
//Ver: //Ver:
// verifies the above sig is created corretly // 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 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 //setup vars
size_t cols = pubs.size(); size_t cols = pubs.size();
CHECK_AND_ASSERT_THROW_MES(cols >= 1, "Empty pubs"); CHECK_AND_ASSERT_THROW_MES(cols >= 1, "Empty pubs");
@ -527,7 +526,6 @@ namespace rct {
// a_out, Cout is for the output commitment // a_out, Cout is for the output commitment
// index is the signing index.. // 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 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 //setup vars
size_t rows = 1; size_t rows = 1;
size_t cols = pubs.size(); size_t cols = pubs.size();
@ -793,7 +791,6 @@ namespace rct {
rv.p.bulletproofs.clear(); rv.p.bulletproofs.clear();
if (bulletproof) if (bulletproof)
{ {
std::vector<uint64_t> proof_amounts;
size_t n_amounts = outamounts.size(); size_t n_amounts = outamounts.size();
size_t amounts_proved = 0; size_t amounts_proved = 0;
if (rct_config.range_proof_type == RangeProofPaddedBulletproof) if (rct_config.range_proof_type == RangeProofPaddedBulletproof)

File diff suppressed because it is too large Load Diff

View File

@ -563,7 +563,6 @@ void toJsonValue(rapidjson::Document& doc, const cryptonote::connection_info& in
{ {
val.SetObject(); val.SetObject();
auto& al = doc.GetAllocator();
INSERT_INTO_JSON_OBJECT(val, doc, incoming, info.incoming); INSERT_INTO_JSON_OBJECT(val, doc, incoming, info.incoming);
INSERT_INTO_JSON_OBJECT(val, doc, localhost, info.localhost); INSERT_INTO_JSON_OBJECT(val, doc, localhost, info.localhost);
INSERT_INTO_JSON_OBJECT(val, doc, local_ip, info.local_ip); INSERT_INTO_JSON_OBJECT(val, doc, local_ip, info.local_ip);

View File

@ -1504,7 +1504,6 @@ PendingTransaction *WalletImpl::createSweepUnmixableTransaction()
{ {
clearStatus(); clearStatus();
vector<cryptonote::tx_destination_entry> dsts;
cryptonote::tx_destination_entry de; cryptonote::tx_destination_entry de;
PendingTransactionImpl * transaction = new PendingTransactionImpl(*this); PendingTransactionImpl * transaction = new PendingTransactionImpl(*this);

View File

@ -44,7 +44,7 @@ namespace mms
namespace bitmessage_rpc namespace bitmessage_rpc
{ {
struct message_info struct message_info_t
{ {
uint32_t encodingType; uint32_t encodingType;
std::string toAddress; std::string toAddress;
@ -66,8 +66,9 @@ namespace bitmessage_rpc
KV_SERIALIZE(subject) KV_SERIALIZE(subject)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<message_info_t> message_info;
struct inbox_messages_response struct inbox_messages_response_t
{ {
std::vector<message_info> inboxMessages; std::vector<message_info> inboxMessages;
@ -75,6 +76,7 @@ namespace bitmessage_rpc
KV_SERIALIZE(inboxMessages) KV_SERIALIZE(inboxMessages)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<inbox_messages_response_t> inbox_messages_response;
} }
@ -116,7 +118,11 @@ bool message_transporter::receive_messages(const std::vector<std::string> &desti
std::string json = get_str_between_tags(answer, "<string>", "</string>"); std::string json = get_str_between_tags(answer, "<string>", "</string>");
bitmessage_rpc::inbox_messages_response bitmessage_res; 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(); size_t size = bitmessage_res.inboxMessages.size();
messages.clear(); messages.clear();
@ -138,8 +144,10 @@ bool message_transporter::receive_messages(const std::vector<std::string> &desti
std::string message_body = epee::string_encoding::base64_decode(message_info.message); 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 // 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); json = epee::string_encoding::base64_decode(message_body);
epee::serialization::load_t_from_json(message, json); if (!epee::serialization::load_t_from_json(message, json))
is_mms_message = true; MERROR("Failed to deserialize message");
else
is_mms_message = true;
} }
catch(const std::exception& e) catch(const std::exception& e)
{ {

View File

@ -42,7 +42,7 @@
namespace mms namespace mms
{ {
struct transport_message struct transport_message_t
{ {
cryptonote::account_public_address source_monero_address; cryptonote::account_public_address source_monero_address;
std::string source_transport_address; std::string source_transport_address;
@ -78,6 +78,7 @@ struct transport_message
KV_SERIALIZE(transport_id) KV_SERIALIZE(transport_id)
END_KV_SERIALIZE_MAP() END_KV_SERIALIZE_MAP()
}; };
typedef epee::misc_utils::struct_init<transport_message_t> transport_message;
class message_transporter class message_transporter
{ {

View File

@ -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 // additional tx pubkeys and derivations for multi-destination transfers involving one or more subaddresses
tx_extra_additional_pub_keys additional_tx_pub_keys; tx_extra_additional_pub_keys additional_tx_pub_keys;
std::vector<crypto::key_derivation> additional_derivations;
if (find_tx_extra_field_by_type(tx_cache_data.tx_extra_fields, additional_tx_pub_keys)) 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) for (size_t i = 0; i < additional_tx_pub_keys.data.size(); ++i)

View File

@ -2192,9 +2192,6 @@ namespace tools
try 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); 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) catch (const std::exception &e)
@ -2911,8 +2908,6 @@ namespace tools
std::vector<std::string> languages; std::vector<std::string> languages;
crypto::ElectrumWords::get_language_list(languages); crypto::ElectrumWords::get_language_list(languages);
std::vector<std::string>::iterator it; std::vector<std::string>::iterator it;
std::string wallet_file;
char *ptr;
it = std::find(languages.begin(), languages.end(), req.language); it = std::find(languages.begin(), languages.end(), req.language);
if (it == languages.end()) if (it == languages.end())

File diff suppressed because it is too large Load Diff