diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-01-31 10:44:08 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-03-24 21:03:19 +0000 |
commit | 91f4c7f45f794fc7bee99356e56853369c98c410 (patch) | |
tree | ca5eb5edbdeb83511b12b39f0b534a3090fc76b4 /src/cryptonote_basic/difficulty.h | |
parent | Merge pull request #5286 (diff) | |
download | monero-91f4c7f45f794fc7bee99356e56853369c98c410.tar.xz |
Make difficulty 128 bit instead of 64 bit
Based on Boolberry work by:
jahrsg <jahr@jahr.me>
cr.zoidberg <crypto.zoidberg@gmail.com>
Diffstat (limited to '')
-rw-r--r-- | src/cryptonote_basic/difficulty.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cryptonote_basic/difficulty.h b/src/cryptonote_basic/difficulty.h index 8da355b22..f7a9376fb 100644 --- a/src/cryptonote_basic/difficulty.h +++ b/src/cryptonote_basic/difficulty.h @@ -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); } |