RandomX integration

Support RandomX PoW algorithm
This commit is contained in:
Howard Chu 2019-04-23 20:32:27 +01:00
parent cb6f96b9d1
commit 81c2ad6d5b
No known key found for this signature in database
GPG key ID: FD2A70B44AB11BA7
24 changed files with 610 additions and 49 deletions

View file

@ -1218,21 +1218,6 @@ namespace cryptonote
return p;
}
//---------------------------------------------------------------
bool get_block_longhash(const block& b, crypto::hash& res, uint64_t height)
{
// block 202612 bug workaround
if (height == 202612)
{
static const std::string longhash_202612 = "84f64766475d51837ac9efbef1926486e58563c95a19fef4aec3254f03000000";
string_tools::hex_to_pod(longhash_202612, res);
return true;
}
blobdata bd = get_block_hashing_blob(b);
const int cn_variant = b.major_version >= 7 ? b.major_version - 6 : 0;
crypto::cn_slow_hash(bd.data(), bd.size(), res, cn_variant, height);
return true;
}
//---------------------------------------------------------------
std::vector<uint64_t> relative_output_offsets_to_absolute(const std::vector<uint64_t>& off)
{
std::vector<uint64_t> res = off;
@ -1253,13 +1238,6 @@ namespace cryptonote
return res;
}
//---------------------------------------------------------------
crypto::hash get_block_longhash(const block& b, uint64_t height)
{
crypto::hash p = null_hash;
get_block_longhash(b, p, height);
return p;
}
//---------------------------------------------------------------
bool parse_and_validate_block_from_blob(const blobdata& b_blob, block& b, crypto::hash *block_hash)
{
std::stringstream ss;