add RandomWOW submodule

master
wowario 5 years ago
parent a2ab66e258
commit cf607654b6
No known key found for this signature in database
GPG Key ID: 24DCBE762DE9C111

5
.gitmodules vendored

@ -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

@ -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()

@ -100,4 +100,4 @@ endif()
add_subdirectory(db_drivers)
add_subdirectory(easylogging++)
add_subdirectory(randomx EXCLUDE_FROM_ALL)
add_subdirectory(RandomWOW EXCLUDE_FROM_ALL)

@ -0,0 +1 @@
Subproject commit ae1377c0d744929ecd7ff5772574b3f758ce967c

1
external/randomx vendored

@ -0,0 +1 @@
Subproject commit 7567cef4c6192fb5356bbdd7db802be77be0439b

@ -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; i<miners-1; i++) {
si[i].si_cache = rs_cache;
@ -225,11 +225,11 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
if (cache == NULL) {
cache = randomx_alloc_cache(flags | RANDOMX_FLAG_LARGE_PAGES);
if (cache == NULL) {
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomX cache");
mdebug(RX_LOGCAT, "Couldn't use largePages for RandomWOW cache");
cache = randomx_alloc_cache(flags);
}
if (cache == NULL)
local_abort("Couldn't allocate RandomX cache");
local_abort("Couldn't allocate RandomWOW cache");
}
}
if (rx_sp->rs_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)

@ -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;

Loading…
Cancel
Save