1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-31 08:54:19 +00:00

Nfactor fix

Sometimes the json parser, will read/apply nfactor before algorithm is set. When that is the case, set_algorithm() will reset nfactor to 10 preventing nscrypt from loading properly. Corrected the function to use previously set nfactor or default to 10.
This commit is contained in:
ystarnaud 2014-06-25 01:01:03 -04:00
parent 78014ab0d5
commit 044bf70901

View File

@ -415,25 +415,37 @@ void copy_algorithm_settings(algorithm_t* dest, const char* algo)
void set_algorithm(algorithm_t* algo, const char* newname_alias)
{
const char* newname;
uint8_t nfactor = 10;
//load previous algorithm nfactor in case nfactor was applied before algorithm... or default to 10
uint8_t nfactor = ((algo->nfactor)?algo->nfactor:10);
// scrypt is default ckolivas kernel
if (strcmp(newname_alias, "scrypt") == 0) {
if(!strcasecmp(newname_alias, "scrypt"))
{
newname = "ckolivas";
nfactor = 10;
}
// Adaptive N-factor Scrypt is default ckolivas kernel with nfactor 11
else if ((strcmp(newname_alias, "adaptive-n-factor") == 0) ||
(strcmp(newname_alias, "adaptive-nfactor") == 0) ||
(strcmp(newname_alias, "nscrypt") == 0) ||
(strcmp(newname_alias, "adaptive-nscrypt") == 0) ||
(strcmp(newname_alias, "adaptive-n-scrypt") == 0)) {
else if ((strcasecmp(newname_alias, "adaptive-n-factor") == 0) ||
(strcasecmp(newname_alias, "adaptive-nfactor") == 0) ||
(strcasecmp(newname_alias, "nscrypt") == 0) ||
(strcasecmp(newname_alias, "adaptive-nscrypt") == 0) ||
(strcasecmp(newname_alias, "adaptive-n-scrypt") == 0))
{
newname = "ckolivas";
nfactor = 11;
// Not an alias
}
else {
newname = newname_alias;
}
//x11mod -> darkcoin-mod
else if(!strcasecmp(newname_alias, "x11mod"))
newname = "darkcoin-mod";
//x13mod -> marucoin-mod
else if(!strcasecmp(newname_alias, "x13mod"))
newname = "marucoin-mod";
//x13modold -> marucoin-modold
else if(!strcasecmp(newname_alias, "x13modold"))
newname = "marucoin-modold";
else
newname = newname_alias;
copy_algorithm_settings(algo, newname);