diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 54b2e8f40..68937caae 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -1820,10 +1820,19 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_ wide_difficulty_type main_pow_diff_begin = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain_type(), connection_point.height - 1, false); main_cumul_diff.pow_diff = main_pow_diff_end - main_pow_diff_begin; - //TODO: measurment of precise cumulative difficult + //TODO: measurement of precise cumulative difficult wide_difficulty_type alt = get_a_to_b_relative_cumulative_difficulty(difficulty_pos_at_split_point, difficulty_pow_at_split_point, alt_cumul_diff, main_cumul_diff); wide_difficulty_type main = get_a_to_b_relative_cumulative_difficulty(difficulty_pos_at_split_point, difficulty_pow_at_split_point, main_cumul_diff, alt_cumul_diff); - + LOG_PRINT_L1("[FORK_CHOICE]: " << ENDL + << "difficulty_pow_at_split_point:" << difficulty_pow_at_split_point << ENDL + << "difficulty_pos_at_split_point:" << difficulty_pos_at_split_point << ENDL + << "alt_cumul_diff.pow_diff:" << alt_cumul_diff.pow_diff << ENDL + << "alt_cumul_diff.pos_diff:" << alt_cumul_diff.pos_diff << ENDL + << "main_cumul_diff.pow_diff:" << main_cumul_diff.pow_diff << ENDL + << "main_cumul_diff.pos_diff:" << main_cumul_diff.pos_diff << ENDL + << "alt:" << alt << ENDL + << "main:" << main << ENDL + ); if (main < alt) return true; else if (main > alt) @@ -1838,7 +1847,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_ if (std::memcmp(&main_chain_bei.stake_hash, &proof_alt, sizeof(main_chain_bei.stake_hash)) >= 0) return false; - LOG_PRINT_L2("[is_reorganize_required]:TRUE, \"by order of memcmp\" main_stake_hash:" << &main_chain_bei.stake_hash << ", alt_stake_hash" << proof_alt); + LOG_PRINT_L1("[is_reorganize_required]:TRUE, \"by order of memcmp\" main_stake_hash:" << &main_chain_bei.stake_hash << ", alt_stake_hash" << proof_alt); return true; } } diff --git a/src/currency_core/blockchain_storage_basic.h b/src/currency_core/blockchain_storage_basic.h index dd3cf3541..7344f200c 100644 --- a/src/currency_core/blockchain_storage_basic.h +++ b/src/currency_core/blockchain_storage_basic.h @@ -63,6 +63,7 @@ namespace currency FIELD(block_cumulative_size) FIELD(cumulative_diff_adjusted) FIELD(cumulative_diff_precise) + FIELD(cumulative_diff_precise_adjusted) FIELD(difficulty) FIELD(already_generated_coins) FIELD(stake_hash) diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index af7ad918c..fce547845 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -202,7 +202,7 @@ #define CURRENT_TRANSACTION_CHAIN_ENTRY_ARCHIVE_VER 3 #define CURRENT_BLOCK_EXTENDED_INFO_ARCHIVE_VER 1 -#define BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION CURRENCY_FORMATION_VERSION + 8 +#define BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION CURRENCY_FORMATION_VERSION + 9 #define BLOCKCHAIN_STORAGE_MINOR_COMPATIBILITY_VERSION 1 diff --git a/src/daemon/daemon_commands_handler.h b/src/daemon/daemon_commands_handler.h index 391f16f4b..593e9163e 100644 --- a/src/daemon/daemon_commands_handler.h +++ b/src/daemon/daemon_commands_handler.h @@ -499,8 +499,15 @@ class daemon_commands_handler bool r = m_srv.get_payload_object().get_core().get_blockchain_storage().get_main_blocks_rpc_details(height, 1, false, blocks); if (r && blocks.size()) { + currency::block b = AUTO_VAL_INIT(b); + m_srv.get_payload_object().get_core().get_blockchain_storage().get_block_by_height(height, b); + currency::blobdata blob = block_to_blob(b); + std::string block_hex = epee::string_tools::buff_to_hex_nodelimer(blob); + currency::block_rpc_extended_info& rbei = blocks.back(); - LOG_PRINT_GREEN("------------------ block_id: " << rbei.id << " ------------------" << ENDL << epee::serialization::store_t_to_json(rbei), LOG_LEVEL_0); + LOG_PRINT_GREEN("------------------ block_id: " << rbei.id << " ------------------" << + ENDL << epee::serialization::store_t_to_json(rbei) << ENDL + << " ------------------ hex_blob: " << ENDL << block_hex, LOG_LEVEL_0); } else { @@ -523,8 +530,14 @@ class daemon_commands_handler if (r) { + currency::block b = AUTO_VAL_INIT(b); + m_srv.get_payload_object().get_core().get_blockchain_storage().get_block_by_hash(block_hash, b); + currency::blobdata blob = block_to_blob(b); + std::string block_hex = epee::string_tools::buff_to_hex_nodelimer(blob); // currency::block& block = bei.bl; - LOG_PRINT_GREEN("------------------ block_id: " << bei.id << " ------------------" << ENDL << epee::serialization::store_t_to_json(bei), LOG_LEVEL_0); + LOG_PRINT_GREEN("------------------ block_id: " << bei.id << " ------------------" << ENDL + << epee::serialization::store_t_to_json(bei) << ENDL + << " ------------------ hex_blob: " << ENDL << block_hex, LOG_LEVEL_0); } else { diff --git a/src/version.h.in b/src/version.h.in index b685d4a89..684424575 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -7,6 +7,6 @@ #define PROJECT_REVISION "0" #define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION -#define PROJECT_VERSION_BUILD_NO 57 +#define PROJECT_VERSION_BUILD_NO 58 #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 "]"