From f335fb539fc4b8fde72e50cbc461b6c5ef7ab8c9 Mon Sep 17 00:00:00 2001 From: Duke Date: Wed, 16 Aug 2023 10:17:13 -0400 Subject: [PATCH] We are calling it ramhash not memhash --- src/hush_globals.h | 6 +++--- src/miner.cpp | 44 ++++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/hush_globals.h b/src/hush_globals.h index 2f9e80f8c..4071ebd6d 100644 --- a/src/hush_globals.h +++ b/src/hush_globals.h @@ -81,13 +81,13 @@ std::vector ASSETCHAINS_PRICES,ASSETCHAINS_STOCKS; // this is the offset in the ASSETCHAINS_ALGORITHMS array #define _ASSETCHAINS_EQUIHASH 0 #define _ASSETCHAINS_RANDOMX 1 -#define _ASSETCHAINS_MEMHASH 2 +#define _ASSETCHAINS_RAMHASH 2 uint32_t ASSETCHAINS_NUMALGOS = 5; // there are different variants of equihash with different (N,K) uint32_t ASSETCHAINS_EQUIHASH = _ASSETCHAINS_EQUIHASH; uint32_t ASSETCHAINS_RANDOMX = _ASSETCHAINS_RANDOMX; -uint32_t ASSETCHAINS_MEMHASH = _ASSETCHAINS_MEMHASH; -const char *ASSETCHAINS_ALGORITHMS[] = {"equihash", "randomx", "memhash"}; +uint32_t ASSETCHAINS_RAMHASH = _ASSETCHAINS_RAMHASH; +const char *ASSETCHAINS_ALGORITHMS[] = {"equihash", "randomx", "ramhash"}; uint64_t ASSETCHAINS_NONCEMASK[] = {0xffff}; uint32_t ASSETCHAINS_NONCESHIFT[] = {32}; uint32_t ASSETCHAINS_HASHESPERROUND[] = {1}; diff --git a/src/miner.cpp b/src/miner.cpp index d18072040..105bf682b 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -118,7 +118,7 @@ public: }; extern int8_t ASSETCHAINS_ADAPTIVEPOW; -extern uint32_t ASSETCHAINS_RANDOMX, ASSETCHAINS_MEMHASH; +extern uint32_t ASSETCHAINS_RANDOMX, ASSETCHAINS_RAMHASH; extern bool fRandomXDebug; void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) @@ -1413,14 +1413,14 @@ void static RandomXMiner() } #ifdef ENABLE_WALLET -void static MemhashMiner(CWallet *pwallet) +void static RamhashMiner(CWallet *pwallet) #else -void static MemhashMiner() +void static RamhashMiner() #endif { - LogPrintf("HushMemhashMiner started\n"); + LogPrintf("HushRamhashMiner started\n"); SetThreadPriority(THREAD_PRIORITY_LOWEST); - RenameThread("hush-memhash"); + RenameThread("hush-ramhash"); const CChainParams& chainparams = Params(); #ifdef ENABLE_WALLET @@ -1448,11 +1448,11 @@ void static MemhashMiner() ); miningTimer.start(); - // TODO: Start actual memhash stuff + // TODO: Start actual ramhash stuff try { - fprintf(stderr,"MemhashMiner: mining %s with memhash\n",SMART_CHAIN_SYMBOL); + fprintf(stderr,"RamhashMiner: mining %s with ramhash\n",SMART_CHAIN_SYMBOL); while(true) { - fprintf(stderr,"MemhashMiner: beginning mining loop on %s with nExtraNonce=%u\n",SMART_CHAIN_SYMBOL, nExtraNonce); + fprintf(stderr,"RamhashMiner: beginning mining loop on %s with nExtraNonce=%u\n",SMART_CHAIN_SYMBOL, nExtraNonce); if (chainparams.MiningRequiresPeers()) { miningTimer.stop(); do { @@ -1496,12 +1496,12 @@ void static MemhashMiner() { miningTimer.stop(); c.disconnect(); - LogPrintf("HushMemhashMiner terminated\n"); + LogPrintf("HushRamhashMiner terminated\n"); return; } static uint32_t counter; if ( counter++ < 10 ) - fprintf(stderr,"MemhashMiner: created illegal blockB, retry with counter=%u\n", counter); + fprintf(stderr,"RamhashMiner: created illegal blockB, retry with counter=%u\n", counter); sleep(1); continue; } @@ -1510,10 +1510,10 @@ void static MemhashMiner() if (!pblocktemplate.get()) { if (GetArg("-mineraddress", "").empty()) { - LogPrintf("Error in HushMemhashMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread\n"); + LogPrintf("Error in HushRamhashMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread\n"); } else { // Should never reach here, because -mineraddress validity is checked in init.cpp - LogPrintf("Error in HushMemhashMiner: Invalid -mineraddress\n"); + LogPrintf("Error in HushRamhashMiner: Invalid -mineraddress\n"); } return; } @@ -1531,7 +1531,7 @@ void static MemhashMiner() } IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); - LogPrintf("Running HushMemhashMiner with %u transactions in block (%u bytes)\n",pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION)); + LogPrintf("Running HushRamhashMiner with %u transactions in block (%u bytes)\n",pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION)); // Search uint8_t pubkeys[66][33]; arith_uint256 bnMaxPoSdiff; uint32_t blocktimes[66]; int mids[256],nonzpkeys,i,j,externalflag; @@ -1547,19 +1547,19 @@ void static MemhashMiner() while (true) { if ( gotinvalid != 0 ) { - fprintf(stderr,"HushMemhashMiner: gotinvalid=%d\n",gotinvalid); + fprintf(stderr,"HushRamhashMiner: gotinvalid=%d\n",gotinvalid); break; } hush_longestchain(); - fprintf(stderr,"HushMemhashMiner: solving with nNonce = %s\n",pblock->nNonce.ToString().c_str()); + fprintf(stderr,"HushRamhashMiner: solving with nNonce = %s\n",pblock->nNonce.ToString().c_str()); arith_uint256 hashTarget; hashTarget = HASHTarget; - CDataStream memhashInput(SER_NETWORK, PROTOCOL_VERSION); + CDataStream ramhashInput(SER_NETWORK, PROTOCOL_VERSION); // Use the current block as input - memhashInput << pblocktemplate->block; - //TODO: calculate actual memhash hash with input + ramhashInput << pblocktemplate->block; + //TODO: calculate actual ramhash hash with input //TODO: Use hash to build a valid block } } @@ -2035,16 +2035,16 @@ void static BitcoinMiner() minerThreads->create_thread(boost::bind(&BitcoinMiner, pwallet)); } else if (ASSETCHAINS_ALGO == ASSETCHAINS_RANDOMX ) { minerThreads->create_thread(boost::bind(&RandomXMiner, pwallet)); - } else if (ASSETCHAINS_ALGO == ASSETCHAINS_MEMHASH ) { - minerThreads->create_thread(boost::bind(&MemhashMiner, pwallet)); + } else if (ASSETCHAINS_ALGO == ASSETCHAINS_RAMHASH ) { + minerThreads->create_thread(boost::bind(&RamhashMiner, pwallet)); } #else if (ASSETCHAINS_ALGO == ASSETCHAINS_EQUIHASH ) { minerThreads->create_thread(&BitcoinMiner); } else if (ASSETCHAINS_ALGO == ASSETCHAINS_RANDOMX) { minerThreads->create_thread(&RandomXMiner); - } else if (ASSETCHAINS_ALGO == ASSETCHAINS_MEMHASH ) { - minerThreads->create_thread(boost::bind(&MemhashMiner)); + } else if (ASSETCHAINS_ALGO == ASSETCHAINS_RAMHASH ) { + minerThreads->create_thread(boost::bind(&RamhashMiner)); } #endif }