From 849c52c7ed8e7a210a916b4981bb2e893fb15d96 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Fri, 27 Jun 2014 12:17:32 -0400 Subject: [PATCH 01/17] Remove unused array in cn_slow_hash --- src/crypto/slow-hash.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c index b4a1c8085..ba95cf679 100644 --- a/src/crypto/slow-hash.c +++ b/src/crypto/slow-hash.c @@ -350,7 +350,6 @@ void cn_slow_hash(const void *data, size_t length, char *hash) RDATA_ALIGN16 uint64_t a[2]; RDATA_ALIGN16 uint64_t b[2]; RDATA_ALIGN16 uint64_t c[2]; - RDATA_ALIGN16 uint8_t aes_key[AES_KEY_SIZE]; union cn_slow_hash_state state; __m128i _a, _b, _c; uint64_t hi, lo; From bd7d20a58a7b1f1bac5ab9afd2700dc59c42707e Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Fri, 27 Jun 2014 12:42:48 -0400 Subject: [PATCH 02/17] Explicit error constructors --- src/wallet/wallet_errors.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wallet/wallet_errors.h b/src/wallet/wallet_errors.h index 71c946545..e25d064c5 100644 --- a/src/wallet/wallet_errors.h +++ b/src/wallet/wallet_errors.h @@ -203,7 +203,7 @@ namespace tools struct refresh_error : public wallet_logic_error { protected: - refresh_error(std::string&& loc, const std::string& message) + explicit refresh_error(std::string&& loc, const std::string& message) : wallet_logic_error(std::move(loc), message) { } @@ -277,7 +277,7 @@ namespace tools struct transfer_error : public wallet_logic_error { protected: - transfer_error(std::string&& loc, const std::string& message) + explicit transfer_error(std::string&& loc, const std::string& message) : wallet_logic_error(std::move(loc), message) { } @@ -287,7 +287,7 @@ namespace tools //---------------------------------------------------------------------------------------------------- struct not_enough_money : public transfer_error { - not_enough_money(std::string&& loc, uint64_t availbable, uint64_t tx_amount, uint64_t fee) + explicit not_enough_money(std::string&& loc, uint64_t availbable, uint64_t tx_amount, uint64_t fee) : transfer_error(std::move(loc), "not enough money") , m_available(availbable) , m_tx_amount(tx_amount) @@ -431,7 +431,7 @@ namespace tools //---------------------------------------------------------------------------------------------------- struct tx_sum_overflow : public transfer_error { - tx_sum_overflow(std::string&& loc, const std::vector& destinations, uint64_t fee) + explicit tx_sum_overflow(std::string&& loc, const std::vector& destinations, uint64_t fee) : transfer_error(std::move(loc), "transaction sum + fee exceeds " + cryptonote::print_money(std::numeric_limits::max())) , m_destinations(destinations) , m_fee(fee) @@ -507,7 +507,7 @@ namespace tools } protected: - wallet_rpc_error(std::string&& loc, const std::string& message, const std::string& request) + explicit wallet_rpc_error(std::string&& loc, const std::string& message, const std::string& request) : wallet_logic_error(std::move(loc), message) , m_request(request) { From 17f09674726295afed09a5fc2b9948298ec5332e Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Fri, 27 Jun 2014 13:21:48 -0400 Subject: [PATCH 03/17] Allow priority peers when there are exclusive peers Per my reading this change makes sense since a subset of the exclusive peers could be priority peers. Priority peers that are not exclusive will not get loaded, and priority peers that *are* exclusive will get special treatment. Prior to this change it looks like priority peers were silently ignored when exclusive peers were provided. --- src/p2p/net_node.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 16140cf35..fd1f57658 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -130,7 +130,7 @@ namespace nodetool if (!parse_peers_and_add_to_container(vm, arg_p2p_add_exclusive_node, m_exclusive_peers)) return false; } - else if (command_line::has_arg(vm, arg_p2p_add_priority_node)) + if (command_line::has_arg(vm, arg_p2p_add_priority_node)) { if (!parse_peers_and_add_to_container(vm, arg_p2p_add_priority_node, m_priority_peers)) return false; From aaced6ff9bf53c339b2016f39994fa7dbc9b6044 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Fri, 27 Jun 2014 13:29:32 -0400 Subject: [PATCH 04/17] Add missing pragma --- src/serialization/json_utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/serialization/json_utils.h b/src/serialization/json_utils.h index 35bcc0335..24f5c11a8 100644 --- a/src/serialization/json_utils.h +++ b/src/serialization/json_utils.h @@ -2,6 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#pragma once + #include #include "json_archive.h" From 5fca5a0e5dd032f21ca8be43753a43c009a88645 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Fri, 27 Jun 2014 14:03:51 -0400 Subject: [PATCH 05/17] Add missing pragma --- src/serialization/binary_utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/serialization/binary_utils.h b/src/serialization/binary_utils.h index d06e8a22a..00bb1741d 100644 --- a/src/serialization/binary_utils.h +++ b/src/serialization/binary_utils.h @@ -2,6 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#pragma once + #include #include "binary_archive.h" From f98c8abf423cd464aa6dcfe318a3871ef5dd0d81 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Fri, 27 Jun 2014 17:07:03 -0400 Subject: [PATCH 06/17] Add missing pragma --- src/serialization/crypto.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/serialization/crypto.h b/src/serialization/crypto.h index b7763ffeb..6e683e629 100644 --- a/src/serialization/crypto.h +++ b/src/serialization/crypto.h @@ -2,6 +2,8 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#pragma once + #include #include "serialization.h" From e344b9c734d86d5d42d76c1e7386a9b6e710715d Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Fri, 27 Jun 2014 17:17:11 -0400 Subject: [PATCH 07/17] Improved (fixed?) serialization for vec --- src/serialization/vector.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/serialization/vector.h b/src/serialization/vector.h index 9a0c0ee56..d07472352 100644 --- a/src/serialization/vector.h +++ b/src/serialization/vector.h @@ -16,6 +16,13 @@ namespace serialization return ::do_serialize(ar, e); } + template + bool serialize_vector_element(Archive& ar, uint32_t& e) + { + ar.serialize_varint(e); + return true; + } + template bool serialize_vector_element(Archive& ar, uint64_t& e) { From b3092d4e00e9667ee8fa3614fd9d68252068c35c Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Fri, 27 Jun 2014 18:06:21 -0400 Subject: [PATCH 08/17] Comment unused functions in cryptonote_core --- src/cryptonote_core/cryptonote_core.cpp | 23 +++++++++++------------ src/cryptonote_core/cryptonote_core.h | 6 +++--- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 2609fc13e..be4917703 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -284,10 +284,10 @@ namespace cryptonote return m_blockchain_storage.get_total_transactions(); } //----------------------------------------------------------------------------------------------- - bool core::get_outs(uint64_t amount, std::list& pkeys) - { - return m_blockchain_storage.get_outs(amount, pkeys); - } + //bool core::get_outs(uint64_t amount, std::list& pkeys) + //{ + // return m_blockchain_storage.get_outs(amount, pkeys); + //} //----------------------------------------------------------------------------------------------- bool core::add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block) { @@ -398,10 +398,10 @@ namespace cryptonote { m_miner.on_synchronized(); } - bool core::get_backward_blocks_sizes(uint64_t from_height, std::vector& sizes, size_t count) - { - return m_blockchain_storage.get_backward_blocks_sizes(from_height, sizes, count); - } + //bool core::get_backward_blocks_sizes(uint64_t from_height, std::vector& sizes, size_t count) + //{ + // return m_blockchain_storage.get_backward_blocks_sizes(from_height, sizes, count); + //} //----------------------------------------------------------------------------------------------- bool core::add_new_block(const block& b, block_verification_context& bvc) { @@ -418,7 +418,6 @@ namespace cryptonote return false; } - block b = AUTO_VAL_INIT(b); if(!parse_and_validate_block_from_blob(block_blob, b)) { @@ -493,9 +492,9 @@ namespace cryptonote return m_blockchain_storage.get_block_by_hash(h, blk); } //----------------------------------------------------------------------------------------------- - void core::get_all_known_block_ids(std::list &main, std::list &alt, std::list &invalid) { - m_blockchain_storage.get_all_known_block_ids(main, alt, invalid); - } + //void core::get_all_known_block_ids(std::list &main, std::list &alt, std::list &invalid) { + // m_blockchain_storage.get_all_known_block_ids(main, alt, invalid); + //} //----------------------------------------------------------------------------------------------- std::string core::print_pool(bool short_format) { diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 1f1b6eec6..ee19ca9e1 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -60,7 +60,7 @@ namespace cryptonote bool get_transactions(const std::vector& txs_ids, std::list& txs, std::list& missed_txs); bool get_transaction(const crypto::hash &h, transaction &tx); bool get_block_by_hash(const crypto::hash &h, block &blk); - void get_all_known_block_ids(std::list &main, std::list &alt, std::list &invalid); + //void get_all_known_block_ids(std::list &main, std::list &alt, std::list &invalid); bool get_alternative_blocks(std::list& blocks); size_t get_alternative_blocks_count(); @@ -71,13 +71,13 @@ namespace cryptonote bool get_pool_transactions(std::list& txs); size_t get_pool_transactions_count(); size_t get_blockchain_total_transactions(); - bool get_outs(uint64_t amount, std::list& pkeys); + //bool get_outs(uint64_t amount, std::list& pkeys); bool have_block(const crypto::hash& id); bool get_short_chain_history(std::list& ids); bool find_blockchain_supplement(const std::list& qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp); bool find_blockchain_supplement(const std::list& qblock_ids, std::list > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count); bool get_stat_info(core_stat_info& st_inf); - bool get_backward_blocks_sizes(uint64_t from_height, std::vector& sizes, size_t count); + //bool get_backward_blocks_sizes(uint64_t from_height, std::vector& sizes, size_t count); bool get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector& indexs); crypto::hash get_tail_id(); bool get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res); From b1413fd045a3ee79c05fac7595789e63396ec56e Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Mon, 30 Jun 2014 15:17:24 -0400 Subject: [PATCH 09/17] C++ style cast --- src/cryptonote_core/cryptonote_format_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index 7b7f18844..c5691d8fe 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -595,7 +595,7 @@ namespace cryptonote { blobdata blob = t_serializable_object_to_blob(static_cast(b)); crypto::hash tree_root_hash = get_tx_tree_hash(b); - blob.append((const char*)&tree_root_hash, sizeof(tree_root_hash )); + blob.append(reinterpret_cast(&tree_root_hash), sizeof(tree_root_hash)); blob.append(tools::get_varint_data(b.tx_hashes.size()+1)); return blob; } From 28af03208bc38eeaa3e903e336412d221571bb92 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Mon, 30 Jun 2014 15:26:29 -0400 Subject: [PATCH 10/17] Remove redeclaration --- src/cryptonote_core/cryptonote_format_utils.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cryptonote_core/cryptonote_format_utils.h b/src/cryptonote_core/cryptonote_format_utils.h index 138fb5224..81d804298 100644 --- a/src/cryptonote_core/cryptonote_format_utils.h +++ b/src/cryptonote_core/cryptonote_format_utils.h @@ -85,7 +85,6 @@ namespace cryptonote uint64_t get_outs_money_amount(const transaction& tx); bool check_inputs_types_supported(const transaction& tx); bool check_outs_valid(const transaction& tx); - blobdata get_block_hashing_blob(const block& b); bool parse_amount(uint64_t& amount, const std::string& str_amount); bool check_money_overflow(const transaction& tx); From 26c83c5dea7a256da65ded6a7624331c52edc3e3 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Mon, 30 Jun 2014 16:07:15 -0400 Subject: [PATCH 11/17] Explicit namespaces --- src/cryptonote_core/blockchain_storage.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index 9e9c77e85..a545b6c61 100644 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -23,8 +23,6 @@ #include "crypto/hash.h" //#include "serialization/json_archive.h" -using namespace std; -using namespace epee; using namespace cryptonote; DISABLE_VS_WARNINGS(4267) @@ -85,14 +83,14 @@ bool blockchain_storage::init(const std::string& config_folder) uint64_t timestamp_diff = time(NULL) - m_blocks.back().bl.timestamp; if(!m_blocks.back().bl.timestamp) timestamp_diff = time(NULL) - 1341378000; - LOG_PRINT_GREEN("Blockchain initialized. last block: " << m_blocks.size()-1 << ", " << misc_utils::get_time_interval_string(timestamp_diff) << " time ago, current difficulty: " << get_difficulty_for_next_block(), LOG_LEVEL_0); + LOG_PRINT_GREEN("Blockchain initialized. last block: " << m_blocks.size() - 1 << ", " << epee::misc_utils::get_time_interval_string(timestamp_diff) << " time ago, current difficulty: " << get_difficulty_for_next_block(), LOG_LEVEL_0); return true; } //------------------------------------------------------------------ bool blockchain_storage::store_blockchain() { m_is_blockchain_storing = true; - misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler([&](){m_is_blockchain_storing=false;}); + epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){m_is_blockchain_storing=false;}); LOG_PRINT_L0("Storing blockchain..."); if (!tools::create_directories_if_necessary(m_config_folder)) @@ -517,8 +515,7 @@ bool blockchain_storage::validate_miner_transaction(const block& b, size_t cumul std::vector last_blocks_sizes; get_last_n_blocks_sizes(last_blocks_sizes, CRYPTONOTE_REWARD_BLOCKS_WINDOW); - if(!get_block_reward(misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward)) - { + if (!get_block_reward(epee::misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward)) { LOG_PRINT_L0("block size " << cumulative_block_size << " is bigger than allowed for this blockchain"); return false; } @@ -707,7 +704,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto:: uint64_t block_height = get_block_height(b); if(0 == block_height) { - LOG_ERROR("Block with id: " << string_tools::pod_to_hex(id) << " (as alternative) have wrong miner transaction"); + LOG_ERROR("Block with id: " << epee::string_tools::pod_to_hex(id) << " (as alternative) have wrong miner transaction"); bvc.m_verifivation_failed = true; return false; } @@ -791,7 +788,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto:: if(!prevalidate_miner_transaction(b, bei.height)) { - LOG_PRINT_RED_L0("Block with id: " << string_tools::pod_to_hex(id) + LOG_PRINT_RED_L0("Block with id: " << epee::string_tools::pod_to_hex(id) << " (as alternative) have wrong miner transaction."); bvc.m_verifivation_failed = true; return false; @@ -1104,7 +1101,7 @@ void blockchain_storage::print_blockchain_outs(const std::string& file) ss << "\t" << vals[i].first << ": " << vals[i].second << ENDL; } } - if(file_io_utils::save_string_to_file(file, ss.str())) + if(epee::file_io_utils::save_string_to_file(file, ss.str())) { LOG_PRINT_L0("Current outputs index writen to file: " << file); }else @@ -1352,7 +1349,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha if(have_tx_keyimg_as_spent(in_to_key.k_image)) { - LOG_PRINT_L1("Key image already spent in blockchain: " << string_tools::pod_to_hex(in_to_key.k_image)); + LOG_PRINT_L1("Key image already spent in blockchain: " << epee::string_tools::pod_to_hex(in_to_key.k_image)); return false; } @@ -1651,7 +1648,7 @@ bool blockchain_storage::update_next_comulative_size_limit() std::vector sz; get_last_n_blocks_sizes(sz, CRYPTONOTE_REWARD_BLOCKS_WINDOW); - uint64_t median = misc_utils::median(sz); + uint64_t median = epee::misc_utils::median(sz); if(median <= CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE) median = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE; From 7259f07a200fd583deb0dca1372bbe5fd760b440 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Tue, 1 Jul 2014 10:55:41 -0400 Subject: [PATCH 12/17] Fix assert bug in base58 encode The previous implementation was almost certainly a typo. full_block_size is the maximum index in the encoded_block_sizes array, and size is used as an index in this array. So now 1 <= size <= full_block_size == 8 instead of 1 <= size <= sizeof(full_block_size) == size_of(size_t) == ? (maybe 4 on 32-bit systems!) --- src/common/base58.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/base58.cpp b/src/common/base58.cpp index 454c0db67..575279aa5 100644 --- a/src/common/base58.cpp +++ b/src/common/base58.cpp @@ -110,7 +110,7 @@ namespace tools void encode_block(const char* block, size_t size, char* res) { - assert(1 <= size && size <= sizeof(full_block_size)); + assert(1 <= size && size <= full_block_size); uint64_t num = uint_8be_to_64(reinterpret_cast(block), size); int i = static_cast(encoded_block_sizes[size]) - 1; From a633c11cbb852bbdceb70f511942525222ee2394 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Tue, 1 Jul 2014 11:48:16 -0400 Subject: [PATCH 13/17] Remove unused function --- src/cryptonote_core/cryptonote_core.cpp | 18 ------------------ src/cryptonote_core/cryptonote_core.h | 1 - 2 files changed, 19 deletions(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index be4917703..2a0129f4e 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -81,24 +81,6 @@ namespace cryptonote return m_blockchain_storage.get_transactions(txs_ids, txs, missed_txs); } //----------------------------------------------------------------------------------------------- - bool core::get_transaction(const crypto::hash &h, transaction &tx) - { - std::vector ids; - ids.push_back(h); - std::list ltx; - std::list missing; - if (m_blockchain_storage.get_transactions(ids, ltx, missing)) - { - if (ltx.size() > 0) - { - tx = *ltx.begin(); - return true; - } - } - - return false; - } - //----------------------------------------------------------------------------------------------- bool core::get_alternative_blocks(std::list& blocks) { return m_blockchain_storage.get_alternative_blocks(blocks); diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index ee19ca9e1..660fcf349 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -58,7 +58,6 @@ namespace cryptonote } crypto::hash get_block_id_by_height(uint64_t height); bool get_transactions(const std::vector& txs_ids, std::list& txs, std::list& missed_txs); - bool get_transaction(const crypto::hash &h, transaction &tx); bool get_block_by_hash(const crypto::hash &h, block &blk); //void get_all_known_block_ids(std::list &main, std::list &alt, std::list &invalid); From 034a1a865e6adf36758258790385d80c8d67c9f0 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Tue, 1 Jul 2014 11:56:41 -0400 Subject: [PATCH 14/17] Allow conditional compilation with VS 2013+ --- tests/io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/io.h b/tests/io.h index 64f2bae77..e3efa62ca 100644 --- a/tests/io.h +++ b/tests/io.h @@ -80,7 +80,7 @@ inline void get(std::istream &input, std::vector &res) { } } -#if !defined(_MSC_VER) +#if !defined(_MSC_VER) || _MSC_VER >= 1800 template typename std::enable_if<(sizeof...(TT) > 0), void>::type From efad8c9f3161ce966cfad2ee94f1806cf141e8f5 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Tue, 1 Jul 2014 12:10:19 -0400 Subject: [PATCH 15/17] Switch list to vector for RPC serialization --- src/rpc/core_rpc_server_commands_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 6e87fb48c..4ea5127f5 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -115,8 +115,8 @@ namespace cryptonote { struct request { - std::list amounts; - uint64_t outs_count; + std::vector amounts; + uint64_t outs_count; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(amounts) KV_SERIALIZE(outs_count) From dee9abcd603d08bff0f33852806cb17b1200f170 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Tue, 1 Jul 2014 12:11:06 -0400 Subject: [PATCH 16/17] Match empty RPC request with other requests --- src/rpc/core_rpc_server_commands_defs.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 4ea5127f5..20f73c9d8 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -414,7 +414,11 @@ namespace cryptonote struct COMMAND_RPC_GET_LAST_BLOCK_HEADER { - typedef std::list request; + struct request + { + BEGIN_KV_SERIALIZE_MAP() + END_KV_SERIALIZE_MAP() + }; struct response { From a016499a0e7a0d93d9253b63d4f2aef2e8441d67 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Tue, 1 Jul 2014 13:01:44 -0400 Subject: [PATCH 17/17] Fix thread count argument handling in simplewallet --- src/simplewallet/simplewallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 6af0de9f9..66b76aa1b 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -499,9 +499,9 @@ bool simple_wallet::start_mining(const std::vector& args) } else if (1 == args.size()) { - uint16_t num; + uint16_t num = 1; ok = string_tools::get_xtype_from_string(num, args[0]); - ok &= (1 <= num && num <= max_mining_threads_count); + ok = ok && (1 <= num && num <= max_mining_threads_count); req.threads_count = num; } else