Implementation of VerusHash CPU-friendly hash algorithm, parameters to enable it, miner, and all changes required to support it on new asset chains

This commit is contained in:
miketout
2018-04-27 00:34:50 -07:00
parent a1af306f81
commit 42181656c2
20 changed files with 1197 additions and 19 deletions

View File

@@ -13,6 +13,7 @@
* *
******************************************************************************/
#include "komodo_defs.h"
#include <string.h>
#ifdef _WIN32
#include <sodium.h>
@@ -1704,6 +1705,27 @@ void komodo_args(char *argv0)
}
if ( name.c_str()[0] != 0 )
{
std:locale loc;
std::string selectedAlgo = std::tolower(GetArg("-ac_algo", std::string(ASSETCHAINS_ALGORITHMS[0])), loc);
for ( int i = 0; i < ASSETCHAINS_NUMALGOS; i++ )
{
if (std::string(ASSETCHAINS_ALGORITHMS[i]) == selectedAlgo)
{
ASSETCHAINS_ALGO = i;
// default is SHA256D, so leave it unless otherwise
if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH)
{
printf("ASSETCHAINS_ALGO, algorithm set to VerusHash\n");
}
break;
}
}
if (i == ASSETCHAINS_NUMALGOS)
{
printf("ASSETCHAINS_ALGO, algorithm not supported. using equihash\n");
}
ASSETCHAINS_LASTERA = GetArg("-ac_eras", 1);
if ( ASSETCHAINS_LASTERA < 1 || ASSETCHAINS_LASTERA > ASSETCHAINS_MAX_ERAS )
{
@@ -1784,6 +1806,11 @@ void komodo_args(char *argv0)
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_TIMEUNLOCKTO),(void *)&ASSETCHAINS_TIMEUNLOCKTO);
}
if ( ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH )
{
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_ALGO),(void *)&ASSETCHAINS_ALGO);
}
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_COMMISSION),(void *)&ASSETCHAINS_COMMISSION);
}