mirror of
https://github.com/monero-project/monero.git
synced 2026-01-02 16:00:10 -08:00
Merge pull request #5402
cbf32241 rpc: make wide_difficulty hexadecimal (moneromooo-monero)
This commit is contained in:
@@ -239,4 +239,19 @@ namespace cryptonote {
|
||||
return res.convert_to<difficulty_type>();
|
||||
}
|
||||
|
||||
std::string hex(difficulty_type v)
|
||||
{
|
||||
static const char chars[] = "0123456789abcdef";
|
||||
std::string s;
|
||||
while (v > 0)
|
||||
{
|
||||
s.push_back(chars[(v & 0xf).convert_to<unsigned>()]);
|
||||
v >>= 4;
|
||||
}
|
||||
if (s.empty())
|
||||
s += "0";
|
||||
std::reverse(s.begin(), s.end());
|
||||
return "0x" + s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
|
||||
#include "crypto/hash.h"
|
||||
@@ -58,4 +59,6 @@ namespace cryptonote
|
||||
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);
|
||||
|
||||
std::string hex(difficulty_type v);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user