diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 5abcf62d..856fd357 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -5463,7 +5463,8 @@ bool blockchain_storage::validate_pos_block(const block& b, uint8_t err = 0; r = crypto::zarcanum_verify_proof(miner_tx_hash, kernel_hash, ring, last_pow_block_id_hashed, stake_input.k_image, sig, &err); CHECK_AND_ASSERT_MES(r, false, "zarcanum_verify_proof failed with code " << err); - + + final_diff = basic_diff; // just for logs return true; } else @@ -5748,7 +5749,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt m_is_in_checkpoint_zone = false; crypto::hash proof_hash = null_hash; - uint64_t pos_coinstake_amount = 0; + uint64_t pos_coinstake_amount = UINT64_MAX; wide_difficulty_type this_coin_diff = 0; bool is_pos_bl = is_pos_block(bl); //check if PoS allowed in this height @@ -6094,7 +6095,12 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt { // PoS int64_t actual_ts = get_block_datetime(bei.bl); // signed int is intentionally used here int64_t ts_diff = actual_ts - m_core_runtime_config.get_core_time(); - powpos_str_entry << "PoS:\t" << proof_hash << ", stake amount: " << print_money_brief(pos_coinstake_amount) << ", final_difficulty: " << this_coin_diff; + powpos_str_entry << "PoS:\t" << proof_hash << ", stake amount: "; + if (pos_coinstake_amount != UINT64_MAX) + powpos_str_entry << print_money_brief(pos_coinstake_amount); + else + powpos_str_entry << "hidden"; + powpos_str_entry << ", final_difficulty: " << this_coin_diff; timestamp_str_entry << ", actual ts: " << actual_ts << " (diff: " << std::showpos << ts_diff << "s) block ts: " << std::noshowpos << bei.bl.timestamp << " (shift: " << std::showpos << static_cast(bei.bl.timestamp) - actual_ts << ")"; } else diff --git a/src/currency_core/blockchain_storage.h b/src/currency_core/blockchain_storage.h index 8749ce94..3ae1bfea 100644 --- a/src/currency_core/blockchain_storage.h +++ b/src/currency_core/blockchain_storage.h @@ -332,6 +332,9 @@ namespace currency bool is_tx_expired(const transaction& tx) const; std::shared_ptr find_key_image_and_related_tx(const crypto::key_image& ki, crypto::hash& id_result) const; + // returns true as soon as the hardfork is active for the NEXT upcoming block (not for the top block in the blockchain storage) + bool is_hardfork_active(size_t hardfork_id) const; + wide_difficulty_type block_difficulty(size_t i)const; bool forecast_difficulty(std::vector> &out_height_2_diff_vector, bool pos) const; bool prune_aged_alt_blocks(); @@ -676,10 +679,6 @@ namespace currency bool is_output_allowed_for_input(const txout_htlc& out_v, const txin_v& in_v, uint64_t top_minus_source_height)const; bool is_output_allowed_for_input(const tx_out_zarcanum& out, const txin_v& in_v) const; - // returns true as soon as the hardfork is active for the NEXT upcoming block (not for the top block in the blockchain storage) - bool is_hardfork_active(size_t hardfork_id) const; - - //POS diff --git a/src/currency_core/currency_format_utils_abstract.h b/src/currency_core/currency_format_utils_abstract.h index 7355c84f..152407c6 100644 --- a/src/currency_core/currency_format_utils_abstract.h +++ b/src/currency_core/currency_format_utils_abstract.h @@ -129,8 +129,9 @@ namespace currency return boost::get(ai); } } - ASSERT_MES_AND_THROW("Objec not found"); + ASSERT_MES_AND_THROW("Object with type " << typeid(specific_type_t).name() << " was not found in a container"); } + //--------------------------------------------------------------- // if cb returns true, it means "continue", false -- means "stop" template bool process_type_in_variant_container(const variant_container_t& av, callback_t& cb, bool return_value_if_none_found = true) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index d3222fc0..d45fecc7 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3168,7 +3168,7 @@ bool wallet2::generate_packing_transaction_if_needed(currency::transaction& tx, //---------------------------------------------------------------------------------------------------- std::string wallet2::get_transfers_str(bool include_spent /*= true*/, bool include_unspent /*= true*/) const { - static const char* header = "index amount g_index flags block tx out# key image"; + static const char* header = "index amount g_index flags block tx out# key image"; std::stringstream ss; ss << header << ENDL; size_t count = 0; @@ -4379,7 +4379,7 @@ void wallet2::dump_trunsfers(std::stringstream& ss, bool verbose) const else { boost::io::ios_flags_saver ifs(ss); - ss << "index amount spent_h g_index block block_ts flg tx out# key image" << ENDL; + ss << "index amount spent_h g_index block block_ts flg tx out# key image" << ENDL; for (size_t i = 0; i != m_transfers.size(); i++) { const transfer_details& td = m_transfers[i]; diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index f9565112..d12d1689 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -699,7 +699,7 @@ namespace tools bool fill_mining_context(mining_context& ctx); void get_transfers(wallet2::transfer_container& incoming_transfers) const; - std::string get_transfers_str(bool include_spent /*= true*/, bool include_unspent /*= true*/) const; + std::string get_transfers_str(bool include_spent = true, bool include_unspent = true) const; // Returns all payments by given id in unspecified order void get_payments(const std::string& payment_id, std::list& payments, uint64_t min_height = 0) const; diff --git a/tests/core_tests/chaingen_main.cpp b/tests/core_tests/chaingen_main.cpp index a06f0476..6b794341 100644 --- a/tests/core_tests/chaingen_main.cpp +++ b/tests/core_tests/chaingen_main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Zano Project +// Copyright (c) 2014-2022 Zano Project // Copyright (c) 2014-2018 The Louisdor Project // Copyright (c) 2012-2013 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying