diff --git a/contrib/epee/include/print_fixed_point_helper.h b/contrib/epee/include/print_fixed_point_helper.h index 43843618..c652f601 100644 --- a/contrib/epee/include/print_fixed_point_helper.h +++ b/contrib/epee/include/print_fixed_point_helper.h @@ -31,9 +31,10 @@ namespace epee { namespace string_tools { - inline std::string print_fixed_decimal_point(uint64_t amount, size_t decimal_point) + template + inline std::string print_fixed_decimal_point(t_number amount, size_t decimal_point) { - std::string s = std::to_string(amount); + std::string s = boost::lexical_cast(amount); if (s.size() < decimal_point + 1) { s.insert(0, decimal_point + 1 - s.size(), '0'); diff --git a/contrib/ethereum/libethash/progpow.cpp b/contrib/ethereum/libethash/progpow.cpp index fd709e8f..a7b85c0e 100644 --- a/contrib/ethereum/libethash/progpow.cpp +++ b/contrib/ethereum/libethash/progpow.cpp @@ -117,9 +117,9 @@ inline uint32_t random_math(uint32_t a, uint32_t b, uint32_t selector) noexcept { default: case 0: - return a + b; - case 1: return a * b; + case 1: + return a + b; case 2: return mul_hi32(a, b); case 3: diff --git a/src/connectivity_tool/conn_tool.cpp b/src/connectivity_tool/conn_tool.cpp index e29adcf2..660de59a 100644 --- a/src/connectivity_tool/conn_tool.cpp +++ b/src/connectivity_tool/conn_tool.cpp @@ -56,6 +56,7 @@ namespace const command_line::arg_descriptor arg_get_info_flags = { "getinfo-flags-hex", "Set of bits for rpc-get-daemon-info", "", true }; const command_line::arg_descriptor arg_set_peer_log_level = { "set-peer-log-level", "Set log level for remote peer", 0, true }; const command_line::arg_descriptor arg_download_peer_log = { "download-peer-log", "Download log from remote peer (starting offset)", 0, true }; + const command_line::arg_descriptor arg_do_consloe_log = { "do-console-log", "Tool generates debug console output(debug purposes)", "", true }; } typedef COMMAND_REQUEST_STAT_INFO_T::stat_info> COMMAND_REQUEST_STAT_INFO; @@ -540,7 +541,7 @@ bool handle_get_daemon_info(po::variables_map& vm) << "pow_sequence_factor: " << res.pow_sequence_factor << ENDL << "last_pos_timestamp: " << res.last_pos_timestamp << ENDL << "last_pow_timestamp: " << res.last_pow_timestamp << ENDL - << "total_coins: " << res.total_coins / COIN << ENDL + << "total_coins: " << res.total_coins << ENDL << "pos_difficulty_in_coins: " << currency::wide_difficulty_type(res.pos_difficulty) / COIN << ENDL << "block_reward: " << res.block_reward << ENDL << "last_block_total_reward: " << res.last_block_total_reward << ENDL @@ -1004,7 +1005,7 @@ int main(int argc, char* argv[]) { string_tools::set_module_name_and_folder(argv[0]); - log_space::get_set_log_detalisation_level(true, LOG_LEVEL_4); + log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2); tools::signal_handler::install_fatal([](int sig_number, void* address) { LOG_ERROR("\n\nFATAL ERROR\nsig: " << sig_number << ", address: " << address); @@ -1036,6 +1037,8 @@ int main(int argc, char* argv[]) command_line::add_arg(desc_params, arg_log_journal_len); command_line::add_arg(desc_params, arg_set_peer_log_level); command_line::add_arg(desc_params, arg_download_peer_log); + command_line::add_arg(desc_params, arg_do_consloe_log); + @@ -1059,6 +1062,11 @@ int main(int argc, char* argv[]) }); if (!r) return 1; + if (command_line::has_arg(vm, arg_do_consloe_log) && command_line::get_arg(vm, arg_do_consloe_log)) + { + log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL); + } + if (command_line::get_arg(vm, command_line::arg_version)) { diff --git a/src/currency_core/basic_pow_helpers.cpp b/src/currency_core/basic_pow_helpers.cpp index 95ed6dfd..6b3e53f1 100644 --- a/src/currency_core/basic_pow_helpers.cpp +++ b/src/currency_core/basic_pow_helpers.cpp @@ -39,16 +39,32 @@ namespace currency return height / ETHASH_EPOCH_LENGTH; } //-------------------------------------------------------------- - crypto::hash get_block_longhash(uint64_t height, const crypto::hash& block_long_ash, uint64_t nonce) + crypto::hash ethash_epoch_to_seed(int epoch) + { + auto res_eth = ethash_calculate_epoch_seed(epoch); + crypto::hash result = currency::null_hash; + memcpy(&result.data, &res_eth, sizeof(res_eth)); + return result; + } + //-------------------------------------------------------------- + crypto::hash get_block_longhash(uint64_t height, const crypto::hash& block_header_hash, uint64_t nonce) { int epoch = ethash_height_to_epoch(height); const auto& context = progpow::get_global_epoch_context_full(static_cast(epoch)); - auto res_eth = progpow::hash(context, height, *(ethash::hash256*)&block_long_ash, nonce); + auto res_eth = progpow::hash(context, height, *(ethash::hash256*)&block_header_hash, nonce); crypto::hash result = currency::null_hash; memcpy(&result.data, &res_eth.final_hash, sizeof(res_eth.final_hash)); return result; } //--------------------------------------------------------------- + crypto::hash get_block_header_mining_hash(const block& b) + { + blobdata bd = get_block_hashing_blob(b); + + access_nonce_in_block_blob(bd) = 0; + return crypto::cn_fast_hash(bd.data(), bd.size()); + } + //--------------------------------------------------------------- void get_block_longhash(const block& b, crypto::hash& res) { /* @@ -57,11 +73,7 @@ namespace currency To achieve the same effect we make blob of data from block in normal way, but then set to zerro nonce inside serialized buffer, and then pass this nonce to ethash algo as a second argument, as it expected. */ - blobdata bd = get_block_hashing_blob(b); - - access_nonce_in_block_blob(bd) = 0; - crypto::hash bl_hash = crypto::cn_fast_hash(bd.data(), bd.size()); - + crypto::hash bl_hash = get_block_header_mining_hash(b); res = get_block_longhash(get_block_height(b), bl_hash, b.nonce); } //--------------------------------------------------------------- diff --git a/src/currency_core/basic_pow_helpers.h b/src/currency_core/basic_pow_helpers.h index ccc1a132..32ded457 100644 --- a/src/currency_core/basic_pow_helpers.h +++ b/src/currency_core/basic_pow_helpers.h @@ -28,7 +28,9 @@ namespace currency { int ethash_height_to_epoch(uint64_t height); - crypto::hash get_block_longhash(uint64_t h, const crypto::hash& block_long_ash, uint64_t nonce); + crypto::hash ethash_epoch_to_seed(int epoch); + crypto::hash get_block_header_mining_hash(const block& b); + crypto::hash get_block_longhash(uint64_t h, const crypto::hash& block_header_hash, uint64_t nonce); void get_block_longhash(const block& b, crypto::hash& res); crypto::hash get_block_longhash(const block& b); diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 19b29ebb..51c082bd 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -1029,7 +1029,7 @@ bool blockchain_storage::validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, - uint64_t already_generated_coins) const + const boost::multiprecision::uint128_t& already_generated_coins) const { CRITICAL_REGION_LOCAL(m_read_lock); //validate reward @@ -1128,7 +1128,7 @@ bool blockchain_storage::create_block_template(block& b, fill_block_template_func_t custom_fill_block_template_func /* = nullptr */) const { size_t median_size; - uint64_t already_generated_coins; + boost::multiprecision::uint128_t already_generated_coins; CRITICAL_REGION_BEGIN(m_read_lock); b.major_version = CURRENT_BLOCK_MAJOR_VERSION; b.minor_version = CURRENT_BLOCK_MINOR_VERSION; @@ -2107,7 +2107,7 @@ bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDO return true; } //------------------------------------------------------------------ -uint64_t blockchain_storage::total_coins() const +boost::multiprecision::uint128_t blockchain_storage::total_coins() const { CRITICAL_REGION_LOCAL(m_read_lock); if (!m_db_blocks.size()) @@ -4295,8 +4295,10 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt if (!check_hash(proof_hash, current_diffic)) { LOG_ERROR("Block with id: " << id << ENDL - << "PoW hash: " << proof_hash << ENDL - << "unexpected difficulty: " << current_diffic); + << "PoW hash: " << proof_hash << ENDL + << "nonce: " << bl.nonce << ENDL + << "header_mining_hash: " << get_block_header_mining_hash(bl) << ENDL + << "expected difficulty: " << current_diffic); bvc.m_verification_failed = true; return false; } @@ -4423,7 +4425,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt } uint64_t base_reward = 0; - uint64_t already_generated_coins = m_db_blocks.size() ? m_db_blocks.back()->already_generated_coins:0; + boost::multiprecision::uint128_t already_generated_coins = m_db_blocks.size() ? m_db_blocks.back()->already_generated_coins:0; if (!validate_miner_transaction(bl, cumulative_block_size, fee_summary, base_reward, already_generated_coins)) { LOG_PRINT_L0("Block with id: " << id diff --git a/src/currency_core/blockchain_storage.h b/src/currency_core/blockchain_storage.h index adfddb91..960b288b 100644 --- a/src/currency_core/blockchain_storage.h +++ b/src/currency_core/blockchain_storage.h @@ -230,7 +230,7 @@ namespace currency wide_difficulty_type get_next_diff_conditional2(bool pos, const alt_chain_type& alt_chain, uint64_t split_height) const; wide_difficulty_type get_cached_next_difficulty(bool pos) const; - typedef bool fill_block_template_func_t(block &bl, bool pos, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height); + typedef bool fill_block_template_func_t(block &bl, bool pos, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height); bool create_block_template(block& b, const account_public_address& miner_address, const account_public_address& stakeholder_address, wide_difficulty_type& di, uint64_t& height, const blobdata& ex_nonce, bool pos, const pos_entry& pe, fill_block_template_func_t custom_fill_block_template_func = nullptr) const; bool create_block_template(block& b, const account_public_address& miner_address, wide_difficulty_type& di, uint64_t& height, const blobdata& ex_nonce) const; @@ -270,7 +270,7 @@ namespace currency uint64_t get_seconds_between_last_n_block(size_t n)const; bool has_multisig_output(const crypto::hash& multisig_id) const; bool is_multisig_output_spent(const crypto::hash& multisig_id) const; - uint64_t total_coins()const; + boost::multiprecision::uint128_t total_coins()const; bool is_pos_allowed()const; uint64_t get_tx_fee_median()const; uint64_t get_tx_expiration_median() const; @@ -280,7 +280,7 @@ namespace currency uint64_t get_last_timestamps_check_window_median() const; uint64_t get_last_n_blocks_timestamps_median(size_t n) const; bool prevalidate_alias_info(const transaction& tx, extra_alias_entry& eae); - bool validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, uint64_t already_generated_coins) const; + bool validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, const boost::multiprecision::uint128_t& already_generated_coins) const; performnce_data& get_performnce_data()const; bool validate_instance(const std::string& path); bool is_tx_expired(const transaction& tx) const; diff --git a/src/currency_core/blockchain_storage_basic.h b/src/currency_core/blockchain_storage_basic.h index d29afc8c..05709aef 100644 --- a/src/currency_core/blockchain_storage_basic.h +++ b/src/currency_core/blockchain_storage_basic.h @@ -48,13 +48,13 @@ namespace currency wide_difficulty_type cumulative_diff_adjusted; wide_difficulty_type cumulative_diff_precise; wide_difficulty_type difficulty; - uint64_t already_generated_coins; + boost::multiprecision::uint128_t already_generated_coins; crypto::hash stake_hash; //TODO: unused field for PoW blocks, subject for refactoring uint32_t version; uint64_t this_block_tx_fee_median; //tx fee median for current block transactions uint64_t effective_tx_fee_median; //current fee median which applied for current block's alias registrations - DEFINE_SERIALIZATION_VERSION(2); + DEFINE_SERIALIZATION_VERSION(1); BEGIN_SERIALIZE_OBJECT() VERSION_ENTRY(version) FIELDS(bl) @@ -65,11 +65,8 @@ namespace currency FIELD(difficulty) FIELD(already_generated_coins) FIELD(stake_hash) - if (version >= 2) - { - FIELD(this_block_tx_fee_median) - FIELD(effective_tx_fee_median) - } + FIELD(this_block_tx_fee_median) + FIELD(effective_tx_fee_median) END_SERIALIZE() }; diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index 86e04f95..3adfb5c6 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -7,7 +7,7 @@ #pragma once -#define CURRENCY_FORMATION_VERSION 78 +#define CURRENCY_FORMATION_VERSION 79 #define CURRENCY_MAX_BLOCK_NUMBER 500000000 @@ -15,7 +15,7 @@ #define CURRENCY_TX_MAX_ALLOWED_OUTS 2000 #define CURRENCY_PUBLIC_ADDRESS_TEXTBLOB_VER 0 #define CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX 197 // addresses start with 'Z' -#define CURRENCY_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX 0x3678 // addresses start with 'iZ' +#define CURRENCY_PUBLIC_INTEG_ADDRESS_BASE58_PREFIX 0x3678 // integrated addresses start with 'iZ' #define CURRENCY_MINED_MONEY_UNLOCK_WINDOW 10 #define CURRENT_TRANSACTION_VERSION 1 #define CURRENT_BLOCK_MAJOR_VERSION 1 @@ -53,7 +53,7 @@ // #define CURRENCY_FIXED_REWARD_ZONE_REWARD_AMOUNT ((uint64_t)100000000) // should be TX_MINIMUM_FEE * CURRENCY_FIXED_REWARD_ZONE_FEE_MULTIPLIER // #define CURRENCY_FIXED_REWARD_ZONE_FEE_MULTIPLIER 1000 // reward in minimum fees for a block in the zone -#define CURRENCY_TESTNET_CONST_REWARD 1000000000 +#define CURRENCY_TESTNET_CONST_REWARD 100000000000000 #define WALLET_MAX_ALLOWED_OUTPUT_AMOUNT ((uint64_t)0xffffffffffffffffLL) @@ -174,7 +174,7 @@ #endif //premine -#define PREMINE_AMOUNT (2000000000000000000) +#define PREMINE_AMOUNT (17517203000000000000U) // 13827203.0 reserved for coinswap, 3690000.0 - premine //alias registration wallet #define ALIAS_REWARDS_ACCOUNT_SPEND_PUB_KEY "0000000000000000000000000000000000000000000000000000000000000000" //burn alias money diff --git a/src/currency_core/currency_core.cpp b/src/currency_core/currency_core.cpp index c4b785f4..0e4e66c4 100644 --- a/src/currency_core/currency_core.cpp +++ b/src/currency_core/currency_core.cpp @@ -451,7 +451,7 @@ namespace currency m_miner.resume(); } //----------------------------------------------------------------------------------------------- - bool core::handle_block_found(const block& b, block_verification_context* p_verification_result /* = nullptr */) + bool core::handle_block_found(const block& b, block_verification_context* p_verification_result, bool need_update_miner_block_template) { TIME_MEASURE_START_MS(time_total_ms); block_verification_context bvc = boost::value_initialized(); @@ -471,7 +471,8 @@ namespace currency //anyway - update miner template TIME_MEASURE_START_MS(time_update_block_template_ms); - update_miner_block_template(); + if (need_update_miner_block_template) + update_miner_block_template(); TIME_MEASURE_FINISH_MS(time_update_block_template_ms); uint64_t time_pack_txs_ms = 0, time_relay_ms = 0; @@ -530,6 +531,11 @@ namespace currency return p_verification_result->m_added_to_main_chain; } //----------------------------------------------------------------------------------------------- + bool core::handle_block_found(const block& b, block_verification_context* p_verification_result /* = nullptr */) + { + return handle_block_found(b, p_verification_result, true); + } + //----------------------------------------------------------------------------------------------- void core::on_synchronized() { m_miner.on_synchronized(); diff --git a/src/currency_core/currency_core.h b/src/currency_core/currency_core.h index 84b2e821..158c6302 100644 --- a/src/currency_core/currency_core.h +++ b/src/currency_core/currency_core.h @@ -49,6 +49,8 @@ namespace currency i_currency_protocol* get_protocol(){return m_pprotocol;} tx_memory_pool& get_tx_pool(){ return m_mempool; }; + bool handle_block_found(const block& b, block_verification_context* p_verification_result, bool need_update_miner_block_template); + //-------------------- i_miner_handler ----------------------- virtual bool handle_block_found(const block& b, block_verification_context* p_verification_result = nullptr); virtual bool get_block_template(block& b, const account_public_address& adr, const account_public_address& stakeholder_address, wide_difficulty_type& diffic, uint64_t& height, const blobdata& ex_nonce, bool pos = false, const pos_entry& pe = pos_entry()); diff --git a/src/currency_core/currency_format_utils.cpp b/src/currency_core/currency_format_utils.cpp index b644fc56..8dff4880 100644 --- a/src/currency_core/currency_format_utils.cpp +++ b/src/currency_core/currency_format_utils.cpp @@ -40,7 +40,7 @@ namespace currency //--------------------------------------------------------------- /* - bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins, + bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t current_block_size, uint64_t fee, const account_public_address &miner_address, @@ -76,7 +76,7 @@ namespace currency return diff; } //------------------------------------------------------------------ - bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins, + bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t current_block_size, uint64_t fee, const account_public_address &miner_address, @@ -122,7 +122,7 @@ namespace currency return construct_miner_tx(height, median_size, already_generated_coins, current_block_size, fee, destinations, tx, extra_nonce, max_outs, pos, pe); } //------------------------------------------------------------------ - bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins, + bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t current_block_size, uint64_t fee, const std::vector& destinations, @@ -1604,15 +1604,7 @@ namespace currency } - std::string print_fixed_decimal_point(uint64_t amount, size_t decimal_point) - { - return epee::string_tools::print_fixed_decimal_point(amount, decimal_point); - } - //--------------------------------------------------------------- - std::string print_money(uint64_t amount) - { - return print_fixed_decimal_point(amount, CURRENCY_DISPLAY_DECIMAL_POINT); - } + //--------------------------------------------------------------- std::string print_money_brief(uint64_t amount) { @@ -1713,10 +1705,10 @@ namespace currency std::cout << std::endl << "Reward change for 10 years:" << std::endl; std::cout << std::setw(10) << std::left << "day" << std::setw(19) << "block reward" << std::setw(19) << "generated coins" << std::endl; - uint64_t already_generated_coins = PREMINE_AMOUNT; - uint64_t money_was_at_begining_of_year = already_generated_coins; - uint64_t total_generated_in_year_by_pos = 0; - uint64_t total_generated_in_year_by_pow = 0; + boost::multiprecision::uint128_t already_generated_coins = PREMINE_AMOUNT; + boost::multiprecision::uint128_t money_was_at_begining_of_year = already_generated_coins; + boost::multiprecision::uint128_t total_generated_in_year_by_pos = 0; + boost::multiprecision::uint128_t total_generated_in_year_by_pow = 0; //uint64_t total_money_supply = TOTAL_MONEY_SUPPLY; uint64_t h = 0; for (uint64_t day = 0; day != 365 * 10; ++day) @@ -1730,8 +1722,8 @@ namespace currency << std::setw(10) << day << std::setw(19) << print_money(emission_reward) << std::setw(4) << print_money(already_generated_coins) - << "(POS: " << std::to_string(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pos, money_was_at_begining_of_year)) << "%" - << ", POW: " << std::to_string(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pow, money_was_at_begining_of_year)) << "%)" + << "(POS: " << boost::lexical_cast(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pos, money_was_at_begining_of_year)) << "%" + << ", POW: " << boost::lexical_cast(GET_PERECENTS_BIG_NUMBERS(total_generated_in_year_by_pow, money_was_at_begining_of_year)) << "%)" << std::setw(19) << ",PoS coins/year: " << print_money(total_generated_in_year_by_pos) << std::setw(19) << ",PoW coins/year:" << print_money(total_generated_in_year_by_pow) @@ -1765,7 +1757,7 @@ namespace currency // std::cout << std::endl << "Reward change for 20 days:" << std::endl; // std::cout << std::setw(10) << std::left << "day" << std::setw(19) << "block reward" << std::setw(19) << "generated coins" << std::endl; // -// uint64_t already_generated_coins = PREMINE_AMOUNT; +// const boost::multiprecision::uint128_t& already_generated_coins = PREMINE_AMOUNT; // //uint64_t total_money_supply = TOTAL_MONEY_SUPPLY; // uint64_t h = 0; // for (uint64_t day = 0; day != 20; ++day) @@ -1798,7 +1790,7 @@ namespace currency ss << std::endl << "Reward change for the first " << n_of_first_blocks << " blocks:" << std::endl; ss << std::setw(10) << std::left << "block #" << std::setw(20) << "block reward" << std::setw(20) << "generated coins" << std::setw(8) << "type" << std::endl; - uint64_t already_generated_coins = 0; + boost::multiprecision::uint128_t already_generated_coins = 0; uint64_t total_generated_pos = 0; uint64_t total_generated_pow = 0; @@ -2296,7 +2288,7 @@ namespace currency pei_rpc.prev_id = epee::string_tools::pod_to_hex(bei_chain.bl.prev_id); pei_rpc.actual_timestamp = get_actual_timestamp(bei_chain.bl); pei_rpc.type = is_pos_block(bei_chain.bl) ? 0 : 1; - pei_rpc.already_generated_coins = bei_chain.already_generated_coins; + pei_rpc.already_generated_coins = boost::lexical_cast(bei_chain.already_generated_coins); pei_rpc.this_block_fee_median = bei_chain.this_block_tx_fee_median; pei_rpc.effective_fee_median = bei_chain.effective_tx_fee_median; pei_rpc.height = bei_chain.height; @@ -2380,7 +2372,7 @@ namespace currency return CURRENCY_MAX_TRANSACTION_BLOB_SIZE; } //----------------------------------------------------------------------------------------------- - uint64_t get_base_block_reward(bool is_pos, uint64_t already_generated_coins, uint64_t height) + uint64_t get_base_block_reward(bool is_pos, const boost::multiprecision::uint128_t& already_generated_coins, uint64_t height) { if (!height) return PREMINE_AMOUNT; @@ -2388,7 +2380,7 @@ namespace currency return CURRENCY_TESTNET_CONST_REWARD; } //----------------------------------------------------------------------------------------------- - bool get_block_reward(bool is_pos, size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint64_t height) + bool get_block_reward(bool is_pos, size_t median_size, size_t current_block_size, const boost::multiprecision::uint128_t& already_generated_coins, uint64_t &reward, uint64_t height) { uint64_t base_reward = get_base_block_reward(is_pos, already_generated_coins, height); diff --git a/src/currency_core/currency_format_utils.h b/src/currency_core/currency_format_utils.h index a984233f..f8b27bdb 100644 --- a/src/currency_core/currency_format_utils.h +++ b/src/currency_core/currency_format_utils.h @@ -14,6 +14,7 @@ #include "account.h" #include "include_base_utils.h" +#include "print_fixed_point_helper.h" #include "currency_format_utils_abstract.h" #include "common/crypto_stream_operators.h" #include "currency_protocol/currency_protocol_defs.h" @@ -163,7 +164,7 @@ namespace currency //--------------------------------------------------------------- - bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins, + bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t current_block_size, uint64_t fee, const account_public_address &miner_address, @@ -174,7 +175,7 @@ namespace currency bool pos = false, const pos_entry& pe = pos_entry()); - bool construct_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins, + bool construct_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t current_block_size, uint64_t fee, const std::vector& destinations, @@ -309,9 +310,7 @@ namespace currency uint64_t get_block_height(const block& b); std::vector relative_output_offsets_to_absolute(const std::vector& off); std::vector absolute_output_offsets_to_relative(const std::vector& off); - // prints amount in format "3.14000000", "0.00000000" - std::string print_money(uint64_t amount); - std::string print_fixed_decimal_point(uint64_t amount, size_t decimal_point); + // prints amount in format "3.14", "0.0" std::string print_money_brief(uint64_t amount); uint64_t get_actual_timestamp(const block& b); @@ -382,8 +381,8 @@ namespace currency /************************************************************************/ size_t get_max_block_size(); size_t get_max_tx_size(); - bool get_block_reward(bool is_pos, size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, uint64_t height); - uint64_t get_base_block_reward(bool is_pos, uint64_t already_generated_coins, uint64_t height); + bool get_block_reward(bool is_pos, size_t median_size, size_t current_block_size, const boost::multiprecision::uint128_t& already_generated_coins, uint64_t &reward, uint64_t height); + uint64_t get_base_block_reward(bool is_pos, const boost::multiprecision::uint128_t& already_generated_coins, uint64_t height); bool is_payment_id_size_ok(const std::string& payment_id); std::string get_account_address_as_str(const account_public_address& addr); std::string get_account_address_and_payment_id_as_str(const account_public_address& addr, const std::string& payment_id); @@ -440,7 +439,7 @@ namespace currency { return alias_info_to_rpc_alias_info(ai.m_alias, ai, ari); } - + //--------------------------------------------------------------- template bool alias_info_to_rpc_alias_info(const std::string& alias, const currency::extra_alias_entry_base& aib, alias_rpc_details_t& ari) { @@ -452,7 +451,19 @@ namespace currency return true; } - + //--------------------------------------------------------------- + template + std::string print_fixed_decimal_point(t_number amount, size_t decimal_point) + { + return epee::string_tools::print_fixed_decimal_point(amount, decimal_point); + } + //--------------------------------------------------------------- + template + std::string print_money(t_number amount) + { + return print_fixed_decimal_point(amount, CURRENCY_DISPLAY_DECIMAL_POINT); + } + //--------------------------------------------------------------- template bool alias_rpc_details_to_alias_info(const alias_rpc_details_t& ard, currency::extra_alias_entry& ai) { diff --git a/src/currency_core/genesis.cpp b/src/currency_core/genesis.cpp index 1ae251af..fba792a8 100644 --- a/src/currency_core/genesis.cpp +++ b/src/currency_core/genesis.cpp @@ -8,7 +8,7 @@ namespace currency { const genesis_tx_raw_data ggenesis_tx_raw = { { - 0xd080800a00000101,0xd20302e3a2de8bd8,0xa4c656f120022dac,0x6e2f69c4efec713d,0x1dab067faa99d2b0,0x004bc2ed989554f5,0xe3a2de8bd8d08080,0x0c893e3c11110302,0x923c676c08c3b3da,0x9d5f9bab3c153f86,0xceec49611dbff8fa,0x8bd8d0808000a087,0xda75030302e3a2de,0x9c6c996e44fb4fa8,0x57da9b191a0ea5e5,0x8300d36ad5146cb0,0x808000f70b26fb7c,0x0302e3a2de8bd8d0,0x0d971710a6f965c0,0x712f15d0c23ca097,0xab0cccfcffca2772,0x4d79952b97b321f0,0xa2de8bd8d0808000,0x6e95a338730302e3,0x699ed30d4fe42200,0x44acb4ec1910cbae,0xac396ca4d07c6032,0xd8d08080007ca3ab,0xf16e0302e3a2de8b,0xa51960554838e739,0x9e49a3a3891d8589,0xfdec3d1c43ce6c6a,0x8000e9d451bab45d,0x02e3a2de8bd8d080,0x441f83683012d103,0xfe5af148188baa39,0x9a6f3f19372b9a63,0xa3af018f526dbcd0,0xde8bd8d0808000fa,0x3002d9a70302e3a2,0x9f8afd984e34d469,0xb839504b8be18512,0x9d6e2d8197e5347e,0xd0808000321a67f6,0x770302e3a2de8bd8,0x13c5c72e5040ae82,0xd3430b8a3a8b8f3e,0x345f656308d8200e,0x008b35ba6c7ac665,0xe3a2de8bd8d08080,0xf47aaa9ee2230302,0x8c75dbd4e43c096d,0xa8479951e6621d52,0x4614fba0a021d84d,0x7b8b69160d00fb3b,0xb9579673ea1bfcd6,0xe6caa4a7a54184fa,0xe460fcdea2efb79c,0x170015f4099060c6,0x627a17ad0517f176,0x4f17b84817ad0717,0x179de517114f17b9,0x000a0e9f2a177c9f }, + 0xa080800e00000101,0x800326b0b4a0f2fd,0x46f236cb0efcd16c,0x547fbb0ff9468d85,0x1da1229cbceeeddf,0x00509f1127de5f6d,0xb0b4a0f2fda08080,0x19fbc70d41860326,0xb0afa73cfe1209ca,0x0d299d4e62aa2f1f,0x7071d8e322c2ebfc,0xf2fda0808000ed15,0x9e5a660326b0b4a0,0x2928590bf14c0f33,0x3dfd3f48e046a8c2,0xfa969b2fa09ad0ed,0x808000acfcbb24be,0x0326b0b4a0f2fda0,0x682ecad7a79177d8,0xc9e501939827d6ec,0x7f55e8f25beacf76,0xc3a22fd82ddcb367,0xb4f89aecdce08000,0x6aeaf9b0de0326b0,0x631393eedf0fc04d,0x8ed9b961192f541a,0x5088f34df1470474,0x93dc80800011241e,0x30b80307d0ffc2e0,0xdcf3a14a0ac108e5,0xd508a0ec648f342d,0x0c1ac8310dcce994,0x8000346b43733822,0x05c6c5bc97b1a080,0x44663811c2802f03,0x5456a1cc803e5b0c,0x9a7c995f82c5bb18,0xe95939d19b769901,0xbc97b1a0808000e9,0xb0624da20305c6c5,0xe7921e8df615d26f,0x27abce5d4d975bc6,0xecb92e6224ce0952,0xa080800085eb1099,0xb10305c6c5bc97b1,0xea6de475ef2cdaaf,0xa47b3fe828343c89,0x8ec5057c0bf7dd44,0x000f2403abe0ade8,0xc6c5bc97b1a08080,0x60e1a72d445b0305,0x8bb2fc2bfd63e41b,0x7772ae843713073b,0xe1c2db8d00c414ff,0x97b1a0808000b5c2,0xd69ad60305c6c5bc,0x8b0b54a7a541d22c,0x312a3c33f20800c1,0xe401b39ce755f512,0x808000d176bfb84a,0x0305c6c5bc97b1a0,0x7711834fbded84b6,0x1d4dca20946a1b23,0x80bfed89b730469e,0x641a20bd14e5d7cf,0xc5bc97b1a0808000,0xca32ddfd2c0305c6,0xf662200d93c916ca,0x0ca700521b6ece14,0x1a14d2365bb10a8e,0xbd88808000fd386e,0xc6e40304dbfb86ad,0xaba7f00aede6da7a,0xc5a36eac7d327196,0x5237aa32dafc085e,0x11003545013f1ed3,0xbd65d3fbab8aa616,0xb8c69175919e298e,0xe4fe3762fd534801,0xba7de375298d061d,0xf917cbb4170015e4,0x1747ce171e061770,0x05d7177e6b170d69,0x69170e891774ff17,0x17882e17c3621765,0x000a0ec1de17d7e4 }, { 0x00 } }; } diff --git a/src/currency_core/genesis.h b/src/currency_core/genesis.h index 3cd77089..73f8f942 100644 --- a/src/currency_core/genesis.h +++ b/src/currency_core/genesis.h @@ -11,7 +11,7 @@ namespace currency #pragma pack(push, 1) struct genesis_tx_raw_data { - uint64_t const v[63]; + uint64_t const v[86]; uint8_t const r[1]; }; #pragma pack(pop) diff --git a/src/currency_core/genesis_acc.cpp b/src/currency_core/genesis_acc.cpp index 50460c4b..aac46ed6 100644 --- a/src/currency_core/genesis_acc.cpp +++ b/src/currency_core/genesis_acc.cpp @@ -9,20 +9,23 @@ namespace currency { - const std::string ggenesis_tx_pub_key_str = "698b7bd6fc1bea739657b9fa8441a5a7a4cae69cb7efa2defc60e4c6609009f4"; + const std::string ggenesis_tx_pub_key_str = "a68aabfbd365bd8e299e917591c6b8014853fd6237fee41d068d2975e37dbae4"; const crypto::public_key ggenesis_tx_pub_key = epee::string_tools::parse_tpod_from_hex_string(ggenesis_tx_pub_key_str); - - const genesis_tx_dictionary_entry ggenesis_dict[10] = { - { 690562910953636312ULL,5 }, - { 940036618224342135ULL,3 }, - { 1343336992873709805ULL,9 }, - { 2417587344126263675ULL,7 }, - { 2976852013260878279ULL,8 }, - { 9662281438621735689ULL,4 }, - { 14708441932961059072ULL,6 }, - { 15678994962012632719ULL,1 }, - { 17191212896741366274ULL,2 }, - { 18291644074790683797ULL,0 } + const genesis_tx_dictionary_entry ggenesis_dict[14] = { + { 898363347618325980ULL,7 }, + { 1234271292339965434ULL,1 }, + { 2785329203593578547ULL,12 }, + { 4955366495399988463ULL,11 }, + { 5233257582118330150ULL,5 }, + { 6604452700210763953ULL,13 }, + { 8712326356392296687ULL,9 }, + { 8863158309745010598ULL,4 }, + { 9527474759752332295ULL,2 }, + { 9921730437908704447ULL,8 }, + { 11109691972771859220ULL,0 }, + { 14297297752337562678ULL,3 }, + { 15951161519112687845ULL,6 }, + { 17472133472787764818ULL,10 } }; } diff --git a/src/currency_core/genesis_acc.h b/src/currency_core/genesis_acc.h index 49af5cce..628c7256 100644 --- a/src/currency_core/genesis_acc.h +++ b/src/currency_core/genesis_acc.h @@ -24,7 +24,7 @@ namespace currency } }; #pragma pack(pop) - extern const genesis_tx_dictionary_entry ggenesis_dict[10]; + extern const genesis_tx_dictionary_entry ggenesis_dict[14]; extern const crypto::public_key ggenesis_tx_pub_key; diff --git a/src/currency_core/tx_pool.cpp b/src/currency_core/tx_pool.cpp index 665e9e92..817f2a55 100644 --- a/src/currency_core/tx_pool.cpp +++ b/src/currency_core/tx_pool.cpp @@ -1046,7 +1046,7 @@ namespace currency bool tx_memory_pool::fill_block_template(block &bl, bool pos, size_t median_size, - uint64_t already_generated_coins, + const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height) diff --git a/src/currency_core/tx_pool.h b/src/currency_core/tx_pool.h index 22dd9948..9e524b43 100644 --- a/src/currency_core/tx_pool.h +++ b/src/currency_core/tx_pool.h @@ -116,7 +116,7 @@ namespace currency // load/store operations bool init(const std::string& config_folder); bool deinit(); - bool fill_block_template(block &bl, bool pos, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height); + bool fill_block_template(block &bl, bool pos, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height); bool get_transactions(std::list& txs) const; bool get_all_transactions_details(std::list& txs)const; bool get_all_transactions_brief_details(std::list& txs)const; diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index bf9c8994..64a38cc2 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -24,23 +24,29 @@ namespace currency { const command_line::arg_descriptor arg_rpc_bind_ip = {"rpc-bind-ip", "", "127.0.0.1"}; const command_line::arg_descriptor arg_rpc_bind_port = {"rpc-bind-port", "", std::to_string(RPC_DEFAULT_PORT)}; + const command_line::arg_descriptor arg_rpc_ignore_status = {"rpc-ignore-offline", "Let rpc calls despite online/offline status", false, true }; } //----------------------------------------------------------------------------------- void core_rpc_server::init_options(boost::program_options::options_description& desc) { command_line::add_arg(desc, arg_rpc_bind_ip); command_line::add_arg(desc, arg_rpc_bind_port); + command_line::add_arg(desc, arg_rpc_ignore_status); } //------------------------------------------------------------------------------------------------------------------------------ core_rpc_server::core_rpc_server(core& cr, nodetool::node_server >& p2p, bc_services::bc_offers_service& of - ) :m_core(cr), m_p2p(p2p), m_of(of), m_session_counter(0) + ) :m_core(cr), m_p2p(p2p), m_of(of), m_session_counter(0), m_ignore_status(false) {} //------------------------------------------------------------------------------------------------------------------------------ bool core_rpc_server::handle_command_line(const boost::program_options::variables_map& vm) { m_bind_ip = command_line::get_arg(vm, arg_rpc_bind_ip); m_port = command_line::get_arg(vm, arg_rpc_bind_port); + if (command_line::has_arg(vm, arg_rpc_ignore_status)) + { + m_ignore_status = command_line::get_arg(vm, arg_rpc_ignore_status); + } return true; } //------------------------------------------------------------------------------------------------------------------------------ @@ -55,6 +61,8 @@ namespace currency bool core_rpc_server::check_core_ready_(const std::string& calling_method) { #ifndef TESTNET + if (m_ignore_status) + return true; if(!m_p2p.get_payload_object().is_synchronized()) { LOG_PRINT_L0("[" << calling_method << "]Core busy cz is_synchronized"); @@ -131,8 +139,12 @@ namespace currency if (pow_bl_ptr) res.last_pow_timestamp = pow_bl_ptr->bl.timestamp; } + boost::multiprecision::uint128_t total_coins = 0; if (req.flags&COMMAND_RPC_GET_INFO_FLAG_TOTAL_COINS) - res.total_coins = m_core.get_blockchain_storage().total_coins(); + { + total_coins = m_core.get_blockchain_storage().total_coins(); + res.total_coins = boost::lexical_cast(total_coins); + } if (req.flags&COMMAND_RPC_GET_INFO_FLAG_LAST_BLOCK_SIZE) { std::vector sz; @@ -151,11 +163,11 @@ namespace currency res.pow_sequence_factor = m_core.get_blockchain_storage().get_current_sequence_factor(false); if (req.flags&(COMMAND_RPC_GET_INFO_FLAG_POS_DIFFICULTY | COMMAND_RPC_GET_INFO_FLAG_TOTAL_COINS)) { - res.block_reward = currency::get_base_block_reward(true, res.total_coins, res.height); + res.block_reward = currency::get_base_block_reward(true, total_coins, res.height); currency::block b = AUTO_VAL_INIT(b); m_core.get_blockchain_storage().get_top_block(b); res.last_block_total_reward = currency::get_reward_from_miner_tx(b.miner_tx); - res.pos_diff_total_coins_rate = (pos_diff / (res.total_coins - PREMINE_AMOUNT + 1)).convert_to(); + res.pos_diff_total_coins_rate = (pos_diff / (total_coins - PREMINE_AMOUNT + 1)).convert_to(); res.last_block_timestamp = b.timestamp; res.last_block_hash = string_tools::pod_to_hex(get_block_hash(b)); } @@ -795,6 +807,10 @@ namespace currency res.blocktemplate_blob = string_tools::buff_to_hex_nodelimer(block_blob); res.prev_hash = string_tools::pod_to_hex(b.prev_id); + + //calculate epoch seed + res.seed = currency::ethash_epoch_to_seed(currency::ethash_height_to_epoch(res.height)); + res.status = CORE_RPC_STATUS_OK; return true; diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h index 53e723c7..c74e31b4 100644 --- a/src/rpc/core_rpc_server.h +++ b/src/rpc/core_rpc_server.h @@ -177,6 +177,7 @@ namespace currency bc_services::bc_offers_service& m_of; std::string m_port; std::string m_bind_ip; + bool m_ignore_status; //mining stuff epee::critical_section m_session_jobs_lock; std::map m_session_jobs; //session id -> blob diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index a2a2c47b..b27d7ddb 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -645,7 +645,7 @@ namespace currency uint64_t pow_sequence_factor; uint64_t last_pow_timestamp; uint64_t last_pos_timestamp; - uint64_t total_coins; + std::string total_coins; uint64_t block_reward; uint64_t last_block_total_reward; uint64_t pos_diff_total_coins_rate; @@ -1234,7 +1234,7 @@ namespace currency std::string pow_seed; uint64_t type; bool is_orphan; - uint64_t already_generated_coins; + std::string already_generated_coins; uint64_t this_block_fee_median; uint64_t effective_fee_median; std::list transactions_details; diff --git a/src/stratum/stratum_server.cpp b/src/stratum/stratum_server.cpp index 58de4622..28c10299 100644 --- a/src/stratum/stratum_server.cpp +++ b/src/stratum/stratum_server.cpp @@ -525,7 +525,7 @@ namespace "nonce: " << nonce << " (0x" << epee::string_tools::pod_to_hex(nonce) << ")", LOG_LEVEL_1); block_verification_context bvc = AUTO_VAL_INIT(bvc); - r = m_p_core->handle_incoming_block(m_block_template, bvc, false); + r = m_p_core->handle_block_found(m_block_template, &bvc, false); if (r) { if (!bvc.m_verification_failed && !bvc.added_to_altchain && bvc.m_added_to_main_chain && !bvc.m_already_exists && !bvc.m_marked_as_orphaned) @@ -821,7 +821,7 @@ namespace } m_json_helper.feed(str, data_size); - LP_CC_WORKER(m_context, "data received: " << data_size << " bytes:" << ENDL << std::string(str, data_size), LOG_LEVEL_4); + LP_CC_WORKER(m_context, "DATA received <<<<<<<<<<<<< " << data_size << " bytes:" << ENDL << std::string(str, data_size), LOG_LEVEL_0); if (m_json_helper.has_objects()) { @@ -975,7 +975,7 @@ namespace void send(const std::string& data) { static_cast(m_p_connection)->do_send(data.c_str(), data.size()); - LOG_PRINT_CC(m_context, "DATA sent >>>>>>>>>>>>> " << ENDL << data, LOG_LEVEL_4); + LOG_PRINT_CC(m_context, "DATA sent >>>>>>>>>>>>> " << ENDL << data, LOG_LEVEL_0); } void send_notification(const std::string& json) diff --git a/src/version.h.in b/src/version.h.in index 500e3e80..3678d223 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -2,6 +2,6 @@ #define BUILD_COMMIT_ID "@VERSION@" #define PROJECT_VERSION "1.0" -#define PROJECT_VERSION_BUILD_NO 12 +#define PROJECT_VERSION_BUILD_NO 14 #define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO) #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]" diff --git a/tests/core_tests/block_reward.cpp b/tests/core_tests/block_reward.cpp index a7d01fd8..8a5771de 100644 --- a/tests/core_tests/block_reward.cpp +++ b/tests/core_tests/block_reward.cpp @@ -31,7 +31,7 @@ bool block_template_against_txs_size::generate(std::vector& ev static size_t g_block_txs_total_size = 0; static uint64_t g_block_txs_fee = 0; -bool custom_fill_block_template_func(block &bl, bool pos, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height) +bool custom_fill_block_template_func(block &bl, bool pos, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height) { total_size = g_block_txs_total_size; fee = g_block_txs_fee; diff --git a/tests/core_tests/chain_switch_pow_pos.cpp b/tests/core_tests/chain_switch_pow_pos.cpp index cf6ec48b..e199ee11 100644 --- a/tests/core_tests/chain_switch_pow_pos.cpp +++ b/tests/core_tests/chain_switch_pow_pos.cpp @@ -29,7 +29,6 @@ gen_chain_switch_pow_pos::gen_chain_switch_pow_pos() bool gen_chain_switch_pow_pos::generate(std::vector& events) const { - return false; // TODO: for test check only, remove pls uint64_t ts_start = 1420000000; std::list miner_stake_sources, alice_stake_sources, bob_stake_sources; diff --git a/tests/core_tests/chaingen_helpers.h b/tests/core_tests/chaingen_helpers.h index 00b193dd..fcd77038 100644 --- a/tests/core_tests/chaingen_helpers.h +++ b/tests/core_tests/chaingen_helpers.h @@ -44,7 +44,7 @@ inline bool mine_next_pow_block_in_playtime_with_given_txs(const currency::accou { struct loc_helper { - static bool fill_block_template_func(currency::block &bl, bool pos, size_t median_size, uint64_t already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height) + static bool fill_block_template_func(currency::block &bl, bool pos, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t &total_size, uint64_t &fee, uint64_t height) { fee = 0; total_size = 0; diff --git a/tests/core_tests/checkpoints_tests.cpp b/tests/core_tests/checkpoints_tests.cpp index 2275b884..a7405288 100644 --- a/tests/core_tests/checkpoints_tests.cpp +++ b/tests/core_tests/checkpoints_tests.cpp @@ -628,7 +628,7 @@ bool gen_no_attchments_in_coinbase::init_config_set_cp(currency::core& c, size_t crc.pos_minimum_heigh = 1; c.get_blockchain_storage().set_core_runtime_config(crc); - m_checkpoints.add_checkpoint(12, "b28d40aa02b30d1f0e807147151b5073dc8dc930414cbbdbde11a9502f9c6936"); + m_checkpoints.add_checkpoint(12, "446b25ca3816e36df92745ea91c3c54a8745db565bafd4d2aa7df9da49220a19"); c.set_checkpoints(currency::checkpoints(m_checkpoints)); return true; diff --git a/tests/core_tests/multisig_wallet_tests.cpp b/tests/core_tests/multisig_wallet_tests.cpp index fee3ea47..b37b2498 100644 --- a/tests/core_tests/multisig_wallet_tests.cpp +++ b/tests/core_tests/multisig_wallet_tests.cpp @@ -1625,7 +1625,7 @@ multisig_and_checkpoints::multisig_and_checkpoints() bool multisig_and_checkpoints::set_cp(currency::core& c, size_t ev_index, const std::vector& events) { currency::checkpoints checkpoints; - checkpoints.add_checkpoint(15, "b9adef016fc8de02ad6d0db526e536a3c2211ee23a2d906f56989465c3e38602"); + checkpoints.add_checkpoint(15, "37da2a30fd8cf1daa05ba11cb2ac5f7a3cc998bce56e4b575fbbea58f0592f5b"); c.set_checkpoints(std::move(checkpoints)); return true; diff --git a/tests/core_tests/pos_block_builder.cpp b/tests/core_tests/pos_block_builder.cpp index 3e854636..95b281a9 100644 --- a/tests/core_tests/pos_block_builder.cpp +++ b/tests/core_tests/pos_block_builder.cpp @@ -106,7 +106,7 @@ void pos_block_builder::step3_build_stake_kernel( } void pos_block_builder::step4_generate_coinbase_tx(size_t median_size, - uint64_t already_generated_coins, + const boost::multiprecision::uint128_t& already_generated_coins, const account_public_address &reward_receiver_address, const blobdata& extra_nonce, size_t max_outs, @@ -165,7 +165,7 @@ void pos_block_builder::step5_sign(const crypto::public_key& stake_tx_pub_key, s m_step = 5; } -bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins, +bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t current_block_size, uint64_t fee, uint64_t pos_stake_amount, diff --git a/tests/core_tests/pos_block_builder.h b/tests/core_tests/pos_block_builder.h index 29b070fc..62d2a9b5 100644 --- a/tests/core_tests/pos_block_builder.h +++ b/tests/core_tests/pos_block_builder.h @@ -25,7 +25,7 @@ struct pos_block_builder uint64_t timestamp_step = POS_SCAN_STEP); void step4_generate_coinbase_tx(size_t median_size, - uint64_t already_generated_coins, + const boost::multiprecision::uint128_t& already_generated_coins, const currency::account_public_address &reward_receiver_address, const currency::blobdata& extra_nonce = currency::blobdata(), size_t max_outs = CURRENCY_MINER_TX_MAX_OUTS, @@ -44,7 +44,7 @@ struct pos_block_builder uint64_t m_pos_stake_amount; }; -bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, uint64_t already_generated_coins, +bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins, size_t current_block_size, uint64_t fee, uint64_t pos_stake_amount,