forked from lthn/blockchain
security improvement in get_a_to_b_relative_cumulative_difficulty()
This commit is contained in:
parent
58c0fff1de
commit
393bf525d6
2 changed files with 6 additions and 5 deletions
|
|
@ -1760,7 +1760,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
|
|||
|
||||
wide_difficulty_type alt_pos_diff_end = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain, alt_chain_bei.height, true);
|
||||
wide_difficulty_type alt_pos_diff_begin = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain_type(), connection_point.height-1, true);
|
||||
alt_cumul_diff.pos_diff = alt_pos_diff_end- alt_pos_diff_begin;
|
||||
alt_cumul_diff.pos_diff = alt_pos_diff_end - alt_pos_diff_begin;
|
||||
|
||||
wide_difficulty_type alt_pow_diff_end = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain, alt_chain_bei.height, false);
|
||||
wide_difficulty_type alt_pow_diff_begin = get_last_alt_x_block_cumulative_precise_adj_difficulty(alt_chain_type(), connection_point.height - 1, false);
|
||||
|
|
|
|||
|
|
@ -2709,10 +2709,11 @@ namespace currency
|
|||
const difficulties& a_diff,
|
||||
const difficulties& b_diff )
|
||||
{
|
||||
const wide_difficulty_type& a_pos_cumulative_difficulty = a_diff.pos_diff != 0 ? a_diff.pos_diff:DIFFICULTY_STARTER;
|
||||
const wide_difficulty_type& b_pos_cumulative_difficulty = b_diff.pos_diff != 0 ? b_diff.pos_diff : DIFFICULTY_STARTER;
|
||||
const wide_difficulty_type& a_pow_cumulative_difficulty = a_diff.pow_diff != 0 ? a_diff.pow_diff : DIFFICULTY_STARTER;
|
||||
const wide_difficulty_type& b_pow_cumulative_difficulty = b_diff.pow_diff != 0 ? b_diff.pow_diff : DIFFICULTY_STARTER;
|
||||
static const wide_difficulty_type difficulty_starter = DIFFICULTY_STARTER;
|
||||
const wide_difficulty_type& a_pos_cumulative_difficulty = a_diff.pos_diff > 0 ? a_diff.pos_diff : difficulty_starter;
|
||||
const wide_difficulty_type& b_pos_cumulative_difficulty = b_diff.pos_diff > 0 ? b_diff.pos_diff : difficulty_starter;
|
||||
const wide_difficulty_type& a_pow_cumulative_difficulty = a_diff.pow_diff > 0 ? a_diff.pow_diff : difficulty_starter;
|
||||
const wide_difficulty_type& b_pow_cumulative_difficulty = b_diff.pow_diff > 0 ? b_diff.pow_diff : difficulty_starter;
|
||||
|
||||
boost::multiprecision::uint1024_t basic_sum = boost::multiprecision::uint1024_t(a_pow_cumulative_difficulty) + (boost::multiprecision::uint1024_t(a_pos_cumulative_difficulty)*difficulty_pow_at_split_point) / difficulty_pos_at_split_point;
|
||||
boost::multiprecision::uint1024_t res =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue