Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptozoidberg committed Sep 23, 2019
2 parents 7dd61ae + ce29cfc commit e0d4ad8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
15 changes: 12 additions & 3 deletions src/currency_core/blockchain_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/currency_core/blockchain_storage_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/currency_core/currency_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
17 changes: 15 additions & 2 deletions src/daemon/daemon_commands_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 "]"

0 comments on commit e0d4ad8

Please sign in to comment.