diff --git a/src/common/callstack_helper.cpp b/src/common/callstack_helper.cpp index eb1be7eb..ab5e3905 100644 --- a/src/common/callstack_helper.cpp +++ b/src/common/callstack_helper.cpp @@ -118,9 +118,9 @@ namespace tools DWORD cb_needed; std::vector module_handles(1); - EnumProcessModules(h_process, &module_handles[0], module_handles.size() * sizeof(HMODULE), &cb_needed); + EnumProcessModules(h_process, &module_handles[0], static_cast(module_handles.size() * sizeof(HMODULE)), &cb_needed); module_handles.resize(cb_needed / sizeof(HMODULE)); - EnumProcessModules(h_process, &module_handles[0], module_handles.size() * sizeof(HMODULE), &cb_needed); + EnumProcessModules(h_process, &module_handles[0], static_cast(module_handles.size() * sizeof(HMODULE)), &cb_needed); std::vector modules; std::transform(module_handles.begin(), module_handles.end(), std::back_inserter(modules), get_mod_info(h_process)); diff --git a/src/currency_core/account.h b/src/currency_core/account.h index 0a049a89..2c325728 100644 --- a/src/currency_core/account.h +++ b/src/currency_core/account.h @@ -34,9 +34,9 @@ namespace currency crypto::secret_key view_secret_key; BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE(account_address) - KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(spend_secret_key) - KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(view_secret_key) + KV_SERIALIZE_N(account_address, "m_account_address") + KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(spend_secret_key, "m_spend_secret_key") + KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(view_secret_key, "m_view_secret_key") END_KV_SERIALIZE_MAP() }; diff --git a/src/currency_core/currency_basic.h b/src/currency_core/currency_basic.h index 876155ea..ff0662f0 100644 --- a/src/currency_core/currency_basic.h +++ b/src/currency_core/currency_basic.h @@ -73,8 +73,8 @@ namespace currency END_SERIALIZE() BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(spend_public_key) - KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(view_public_key) + KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(spend_public_key, "m_spend_public_key") + KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(view_public_key, "m_view_public_key") END_KV_SERIALIZE_MAP() }; #pragma pack(pop) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 26a0e24d..debda5b4 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1070,7 +1070,7 @@ void wallet2::process_unconfirmed(const currency::transaction& tx, std::vector& stop) return; } THROW_IF_TRUE_WALLET_EX(res.status != CORE_RPC_STATUS_OK, error::get_blocks_error, res.status); - THROW_IF_TRUE_WALLET_EX(get_blockchain_current_size() && get_blockchain_current_size() <= res.start_height, error::wallet_internal_error, + THROW_IF_TRUE_WALLET_EX(get_blockchain_current_size() && get_blockchain_current_size() <= res.start_height && res.start_height != m_minimum_height, error::wallet_internal_error, "wrong daemon response: m_start_height=" + std::to_string(res.start_height) + " not less than local blockchain size=" + std::to_string(get_blockchain_current_size())); @@ -1227,7 +1229,7 @@ void wallet2::handle_pulled_blocks(size_t& blocks_added, std::atomic& stop //TODO: get_block_hash is slow crypto::hash bl_id = get_block_hash(bl); - if (height > processed_blocks_count) + if (processed_blocks_count != 1 && height > processed_blocks_count) {//internal error: WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(false, "height{" << height <<"} > processed_blocks_count{" << processed_blocks_count << "}"); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 7592132c..f21fa649 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -47,6 +47,7 @@ #define WALLET_DEFAULT_POS_MINT_PACKING_SIZE 100 +const uint64_t WALLET_MINIMUM_HEIGHT_UNSET_CONST = std::numeric_limits::max(); #undef LOG_DEFAULT_CHANNEL #define LOG_DEFAULT_CHANNEL "wallet" @@ -318,7 +319,7 @@ namespace tools m_do_rise_transfer(false), m_watch_only(false), m_last_pow_block_h(0), - m_minimum_height(0), + m_minimum_height(WALLET_MINIMUM_HEIGHT_UNSET_CONST), m_pos_mint_packing_size(WALLET_DEFAULT_POS_MINT_PACKING_SIZE) {}; public: @@ -333,7 +334,7 @@ namespace tools m_log_prefix("???"), m_watch_only(false), m_last_pow_block_h(0), - m_minimum_height(0), + m_minimum_height(WALLET_MINIMUM_HEIGHT_UNSET_CONST), m_pos_mint_packing_size(WALLET_DEFAULT_POS_MINT_PACKING_SIZE) { m_core_runtime_config = currency::get_default_core_runtime_config(); @@ -677,7 +678,7 @@ namespace tools } } //convert from old version - if (ver < CURRENCY_FORMATION_VERSION + 65) + if (ver < 150) { LOG_PRINT_MAGENTA("Converting blockchain into a short form...", LOG_LEVEL_0); std::vector old_blockchain; @@ -686,12 +687,14 @@ namespace tools for (auto& h : old_blockchain) { m_chain.push_new_block_id(h, count); + count++; } LOG_PRINT_MAGENTA("Converting done", LOG_LEVEL_0); } else { a & m_chain; + a & m_minimum_height; } diff --git a/src/wallet/wallet_chain_shortener.cpp b/src/wallet/wallet_chain_shortener.cpp index c89b100d..9d30cb5f 100644 --- a/src/wallet/wallet_chain_shortener.cpp +++ b/src/wallet/wallet_chain_shortener.cpp @@ -61,12 +61,12 @@ void wallet_chain_shortener::push_new_block_id(const crypto::hash& id, uint64_t //primary 10 //self check - if (!m_last_20_blocks.empty()) + if (m_local_bc_size != 1) { THROW_IF_FALSE_WALLET_INT_ERR_EX(get_blockchain_current_size() == height, "Inernal error: get_blockchain_current_height(){" << get_blockchain_current_size() << "} == height{" << height << "} is not equal"); } - m_local_bc_size++; + m_local_bc_size = height+1; m_last_20_blocks[height] = id; if (m_last_20_blocks.size() > WALLET_EVERYBLOCK_SIZE) {