diff --git a/.gitmodules b/.gitmodules index 6e2339fb9..001e16c63 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,3 +12,8 @@ [submodule "external/trezor-common"] path = external/trezor-common url = https://github.com/trezor/trezor-common.git +[submodule "external/RandomWOW"] + path = external/RandomWOW + url = https://github.com/wownero/RandomWOW + branch = 1.1.6-wow + diff --git a/CMakeLists.txt b/CMakeLists.txt index c0ec0c2b8..baccf1751 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,7 +211,7 @@ if(NOT MANUAL_SUBMODULES) check_submodule(external/unbound) check_submodule(external/rapidjson) check_submodule(external/trezor-common) - check_submodule(external/randomx) + check_submodule(external/RandomWOW) endif() endif() diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index d51ed36c7..6549236af 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -100,4 +100,4 @@ endif() add_subdirectory(db_drivers) add_subdirectory(easylogging++) -add_subdirectory(randomx EXCLUDE_FROM_ALL) +add_subdirectory(RandomWOW EXCLUDE_FROM_ALL) diff --git a/external/RandomWOW b/external/RandomWOW new file mode 160000 index 000000000..ae1377c0d --- /dev/null +++ b/external/RandomWOW @@ -0,0 +1 @@ +Subproject commit ae1377c0d744929ecd7ff5772574b3f758ce967c diff --git a/external/randomx b/external/randomx new file mode 160000 index 000000000..7567cef4c --- /dev/null +++ b/external/randomx @@ -0,0 +1 @@ +Subproject commit 7567cef4c6192fb5356bbdd7db802be77be0439b diff --git a/src/crypto/rx-slow-hash.c b/src/crypto/rx-slow-hash.c index 606c67336..bbf6476d4 100644 --- a/src/crypto/rx-slow-hash.c +++ b/src/crypto/rx-slow-hash.c @@ -161,11 +161,11 @@ static void rx_initdata(randomx_cache *rs_cache, const int miners, const uint64_ CTHR_THREAD_TYPE *st; si = malloc(miners * sizeof(seedinfo)); if (si == NULL) - local_abort("Couldn't allocate RandomX mining threadinfo"); + local_abort("Couldn't allocate RandomWOW mining threadinfo"); st = malloc(miners * sizeof(CTHR_THREAD_TYPE)); if (st == NULL) { free(si); - local_abort("Couldn't allocate RandomX mining threadlist"); + local_abort("Couldn't allocate RandomWOW mining threadlist"); } for (i=0; irs_height != seedheight || rx_sp->rs_cache == NULL || memcmp(seedhash, rx_sp->rs_hash, HASH_SIZE)) { @@ -251,7 +251,7 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch if (rx_dataset == NULL) { rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES); if (rx_dataset == NULL) { - mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX dataset"); + mdebug(RX_LOGCAT, "Couldn't use largePages for RandomWOW dataset"); rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_DEFAULT); } if (rx_dataset != NULL) @@ -264,14 +264,14 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch miners = 0; if (!rx_dataset_nomem) { rx_dataset_nomem = 1; - mwarning(RX_LOGCAT, "Couldn't allocate RandomX dataset for miner"); + mwarning(RX_LOGCAT, "Couldn't allocate RandomWOW dataset for miner"); } } CTHR_MUTEX_UNLOCK(rx_dataset_mutex); } rx_vm = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, rx_sp->rs_cache, rx_dataset); if(rx_vm == NULL) { //large pages failed - mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX VM"); + mdebug(RX_LOGCAT, "Couldn't use largePages for RandomWOW VM"); rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset); } if(rx_vm == NULL) {//fallback if everything fails @@ -279,7 +279,7 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch rx_vm = randomx_create_vm(flags, rx_sp->rs_cache, rx_dataset); } if (rx_vm == NULL) - local_abort("Couldn't allocate RandomX VM"); + local_abort("Couldn't allocate RandomWOW VM"); } else if (miners) { CTHR_MUTEX_LOCK(rx_dataset_mutex); if (rx_dataset != NULL && rx_dataset_height != seedheight) diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index f662028ff..b41f2793f 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -680,13 +680,6 @@ namespace cryptonote bool get_block_longhash(const Blockchain *pbc, const block& b, crypto::hash& res, const uint64_t height, const int miners) { - // block 202612 bug workaround - if (height == 202612) - { - static const std::string longhash_202612 = "84f64766475d51837ac9efbef1926486e58563c95a19fef4aec3254f03000000"; - epee::string_tools::hex_to_pod(longhash_202612, res); - return true; - } blobdata bd = get_block_hashing_blob(b); if (b.major_version >= RX_BLOCK_VERSION) { @@ -705,7 +698,7 @@ namespace cryptonote } rx_slow_hash(main_height, seed_height, hash.data, bd.data(), bd.size(), res.data, miners, 0); } else { - const int pow_variant = b.major_version >= 7 ? b.major_version - 6 : 0; + const int pow_variant = b.major_version >= 13 ? 6 : b.major_version >= 11 && b.major_version <= 12 ? 4 : 2; crypto::cn_slow_hash(bd.data(), bd.size(), res, pow_variant, height); } return true;