Merge pull request #6223

c3613031 Silence miner debugmsg spam (Howard Chu)
This commit is contained in:
Alexander Blair 2020-02-28 19:45:54 -08:00
commit 6742c4acb7
No known key found for this signature in database
GPG Key ID: C64552D877C32479
1 changed files with 14 additions and 7 deletions

View File

@ -62,6 +62,7 @@ static CTHR_MUTEX_TYPE rx_dataset_mutex = CTHR_MUTEX_INIT;
static rx_state rx_s[2] = {{CTHR_MUTEX_INIT,{0},0,0},{CTHR_MUTEX_INIT,{0},0,0}}; static rx_state rx_s[2] = {{CTHR_MUTEX_INIT,{0},0,0},{CTHR_MUTEX_INIT,{0},0,0}};
static randomx_dataset *rx_dataset; static randomx_dataset *rx_dataset;
static int rx_dataset_nomem;
static uint64_t rx_dataset_height; static uint64_t rx_dataset_height;
static THREADV randomx_vm *rx_vm = NULL; static THREADV randomx_vm *rx_vm = NULL;
@ -246,6 +247,7 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
} }
if (miners) { if (miners) {
CTHR_MUTEX_LOCK(rx_dataset_mutex); CTHR_MUTEX_LOCK(rx_dataset_mutex);
if (!rx_dataset_nomem) {
if (rx_dataset == NULL) { if (rx_dataset == NULL) {
rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES); rx_dataset = randomx_alloc_dataset(RANDOMX_FLAG_LARGE_PAGES);
if (rx_dataset == NULL) { if (rx_dataset == NULL) {
@ -255,12 +257,16 @@ void rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const ch
if (rx_dataset != NULL) if (rx_dataset != NULL)
rx_initdata(rx_sp->rs_cache, miners, seedheight); rx_initdata(rx_sp->rs_cache, miners, seedheight);
} }
}
if (rx_dataset != NULL) if (rx_dataset != NULL)
flags |= RANDOMX_FLAG_FULL_MEM; flags |= RANDOMX_FLAG_FULL_MEM;
else { else {
miners = 0; 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 RandomX dataset for miner");
} }
}
CTHR_MUTEX_UNLOCK(rx_dataset_mutex); CTHR_MUTEX_UNLOCK(rx_dataset_mutex);
} }
rx_vm = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, rx_sp->rs_cache, rx_dataset); rx_vm = randomx_create_vm(flags | RANDOMX_FLAG_LARGE_PAGES, rx_sp->rs_cache, rx_dataset);
@ -309,5 +315,6 @@ void rx_stop_mining(void) {
rx_dataset = NULL; rx_dataset = NULL;
randomx_release_dataset(rd); randomx_release_dataset(rd);
} }
rx_dataset_nomem = 0;
CTHR_MUTEX_UNLOCK(rx_dataset_mutex); CTHR_MUTEX_UNLOCK(rx_dataset_mutex);
} }