@ -118,7 +118,7 @@ public:
} ;
extern int8_t ASSETCHAINS_ADAPTIVEPOW ;
extern uint32_t ASSETCHAINS_RANDOMX , ASSETCHAINS_ME MHASH ;
extern uint32_t ASSETCHAINS_RANDOMX , ASSETCHAINS_RA MHASH ;
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 Me mhashMiner( CWallet * pwallet )
void static Ra mhashMiner( CWallet * pwallet )
# else
void static Me mhashMiner( )
void static Ra mhashMiner( )
# endif
{
LogPrintf ( " HushMe mhashMiner started \n " ) ;
LogPrintf ( " HushRa mhashMiner started \n " ) ;
SetThreadPriority ( THREAD_PRIORITY_LOWEST ) ;
RenameThread ( " hush-me mhash " ) ;
RenameThread ( " hush-ra mhash " ) ;
const CChainParams & chainparams = Params ( ) ;
# ifdef ENABLE_WALLET
@ -1448,11 +1448,11 @@ void static MemhashMiner()
) ;
miningTimer . start ( ) ;
// TODO: Start actual me mhash stuff
// TODO: Start actual ra mhash stuff
try {
fprintf ( stderr , " MemhashMiner: mining %s with me mhash\n " , SMART_CHAIN_SYMBOL ) ;
fprintf ( stderr , " RamhashMiner: mining %s with ra mhash\n " , SMART_CHAIN_SYMBOL ) ;
while ( true ) {
fprintf ( stderr , " Me mhashMiner: beginning mining loop on %s with nExtraNonce=%u\n " , SMART_CHAIN_SYMBOL , nExtraNonce ) ;
fprintf ( stderr , " Ra mhashMiner: 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 ( " HushMe mhashMiner terminated \n " ) ;
LogPrintf ( " HushRa mhashMiner terminated \n " ) ;
return ;
}
static uint32_t counter ;
if ( counter + + < 10 )
fprintf ( stderr , " Me mhashMiner: created illegal blockB, retry with counter=%u\n " , counter ) ;
fprintf ( stderr , " Ra mhashMiner: 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 HushMe mhashMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread \n " ) ;
LogPrintf ( " Error in HushRa mhashMiner: 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 HushMe mhashMiner: Invalid -mineraddress \n " ) ;
LogPrintf ( " Error in HushRa mhashMiner: Invalid -mineraddress \n " ) ;
}
return ;
}
@ -1531,7 +1531,7 @@ void static MemhashMiner()
}
IncrementExtraNonce ( pblock , pindexPrev , nExtraNonce ) ;
LogPrintf ( " Running HushMe mhashMiner with %u transactions in block (%u bytes) \n " , pblock - > vtx . size ( ) , : : GetSerializeSize ( * pblock , SER_NETWORK , PROTOCOL_VERSION ) ) ;
LogPrintf ( " Running HushRa mhashMiner 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 , " HushMe mhashMiner: gotinvalid=%d \n " , gotinvalid ) ;
fprintf ( stderr , " HushRa mhashMiner: gotinvalid=%d \n " , gotinvalid ) ;
break ;
}
hush_longestchain ( ) ;
fprintf ( stderr , " HushMe mhashMiner: solving with nNonce = %s \n " , pblock - > nNonce . ToString ( ) . c_str ( ) ) ;
fprintf ( stderr , " HushRa mhashMiner: solving with nNonce = %s \n " , pblock - > nNonce . ToString ( ) . c_str ( ) ) ;
arith_uint256 hashTarget ;
hashTarget = HASHTarget ;
CDataStream me mhashInput( SER_NETWORK , PROTOCOL_VERSION ) ;
CDataStream ra mhashInput( SER_NETWORK , PROTOCOL_VERSION ) ;
// Use the current block as input
me mhashInput < < pblocktemplate - > block ;
//TODO: calculate actual me mhash hash with input
ra mhashInput < < pblocktemplate - > block ;
//TODO: calculate actual ra mhash 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_ME MHASH ) {
minerThreads - > create_thread ( boost : : bind ( & Me mhashMiner, pwallet ) ) ;
} else if ( ASSETCHAINS_ALGO = = ASSETCHAINS_RA MHASH ) {
minerThreads - > create_thread ( boost : : bind ( & Ra mhashMiner, 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_ME MHASH ) {
minerThreads - > create_thread ( boost : : bind ( & Me mhashMiner) ) ;
} else if ( ASSETCHAINS_ALGO = = ASSETCHAINS_RA MHASH ) {
minerThreads - > create_thread ( boost : : bind ( & Ra mhashMiner) ) ;
}
# endif
}