mirror of
https://github.com/monero-project/monero.git
synced 2025-08-05 08:44:21 -04:00
Make difficulty 128 bit instead of 64 bit
Based on Boolberry work by: jahrsg <jahr@jahr.me> cr.zoidberg <crypto.zoidberg@gmail.com>
This commit is contained in:
parent
e4b049da05
commit
91f4c7f45f
30 changed files with 787 additions and 62 deletions
|
@ -1997,7 +1997,7 @@ bool Blockchain::find_blockchain_supplement(const std::list<crypto::hash>& qbloc
|
|||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
uint64_t Blockchain::block_difficulty(uint64_t i) const
|
||||
difficulty_type Blockchain::block_difficulty(uint64_t i) const
|
||||
{
|
||||
LOG_PRINT_L3("Blockchain::" << __func__);
|
||||
// WARNING: this function does not take m_blockchain_lock, and thus should only call read only
|
||||
|
@ -2196,7 +2196,11 @@ bool Blockchain::find_blockchain_supplement(const std::list<crypto::hash>& qbloc
|
|||
|
||||
bool result = find_blockchain_supplement(qblock_ids, resp.m_block_ids, resp.start_height, resp.total_height);
|
||||
if (result)
|
||||
resp.cumulative_difficulty = m_db->get_block_cumulative_difficulty(resp.total_height - 1);
|
||||
{
|
||||
cryptonote::difficulty_type wide_cumulative_difficulty = m_db->get_block_cumulative_difficulty(resp.total_height - 1);
|
||||
resp.cumulative_difficulty = (wide_cumulative_difficulty << 64 >> 64).convert_to<uint64_t>();
|
||||
resp.cumulative_difficulty_top64 = (wide_cumulative_difficulty >> 64).convert_to<uint64_t>();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -653,7 +653,7 @@ namespace cryptonote
|
|||
*
|
||||
* @return the difficulty
|
||||
*/
|
||||
uint64_t block_difficulty(uint64_t i) const;
|
||||
difficulty_type block_difficulty(uint64_t i) const;
|
||||
|
||||
/**
|
||||
* @brief gets blocks based on a list of block hashes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue