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:
moneromooo-monero 2019-01-31 10:44:08 +00:00
parent e4b049da05
commit 91f4c7f45f
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
30 changed files with 787 additions and 62 deletions

View file

@ -32,12 +32,13 @@
#include <cstdint>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>
#include "crypto/hash.h"
namespace cryptonote
{
typedef std::uint64_t difficulty_type;
typedef boost::multiprecision::uint128_t difficulty_type;
/**
* @brief checks if a hash fits the given difficulty
@ -51,6 +52,10 @@ namespace cryptonote
*
* @return true if valid, else false
*/
bool check_hash_64(const crypto::hash &hash, uint64_t difficulty);
uint64_t next_difficulty_64(std::vector<std::uint64_t> timestamps, std::vector<uint64_t> cumulative_difficulties, size_t target_seconds);
bool check_hash_128(const crypto::hash &hash, difficulty_type difficulty);
bool check_hash(const crypto::hash &hash, difficulty_type difficulty);
difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds);
}