mirror of
https://github.com/monero-project/monero.git
synced 2026-01-13 13:27:34 -08:00
Merge pull request #749
bfd4a28Update BlockchainDB documentation (Thomas Winget)797357eChange Doxyfile, Blockchain not blockchain_storage (Thomas Winget)c835215remove defunct code from cryptonote::core (Thomas Winget)50dba6dcryptonote::core doxygen documentation (Thomas Winget)8ac329ddoxygen documentation for difficulty functions (Thomas Winget)540a76cMove checkpoint functions into checkpoints class (Thomas Winget)1b0c98edoxygen documentation for checkpoints.{h,cpp} (Thomas Winget)89c24acRemove unnecessary or defunct code (Thomas Winget)ab0ed14doxygen include private and static members (Thomas Winget)3a48449Updated documentation for blockchain.* (Thomas Winget)
This commit is contained in:
@@ -116,8 +116,8 @@ namespace cryptonote {
|
||||
return !carry;
|
||||
}
|
||||
|
||||
difficulty_type next_difficulty(vector<uint64_t> timestamps, vector<difficulty_type> cumulative_difficulties, size_t target_seconds) {
|
||||
//cutoff DIFFICULTY_LAG
|
||||
difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds) {
|
||||
|
||||
if(timestamps.size() > DIFFICULTY_WINDOW)
|
||||
{
|
||||
timestamps.resize(DIFFICULTY_WINDOW);
|
||||
@@ -151,6 +151,8 @@ namespace cryptonote {
|
||||
assert(total_work > 0);
|
||||
uint64_t low, high;
|
||||
mul(total_work, target_seconds, low, high);
|
||||
// blockchain errors "difficulty overhead" if this function returns zero.
|
||||
// TODO: consider throwing an exception instead
|
||||
if (high != 0 || low + time_span - 1 < low) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user