Browse Source

Algorithm alias fix

Added "old" algorithms and also corrected `nfactor` in case it's parsed before `algorithm`.
djm34
ystarnaud 11 years ago
parent
commit
8001dc027b
  1. 16
      algorithm.c

16
algorithm.c

@ -647,8 +647,12 @@ static const char *lookup_algorithm_alias(const char *lookup_alias, uint8_t *nfa @@ -647,8 +647,12 @@ static const char *lookup_algorithm_alias(const char *lookup_alias, uint8_t *nfa
ALGO_ALIAS("x11", "darkcoin-mod");
ALGO_ALIAS("x13mod", "marucoin-mod");
ALGO_ALIAS("x13", "marucoin-mod");
ALGO_ALIAS("x13old", "marucoin-modold");
ALGO_ALIAS("x13modold", "marucoin-modold");
ALGO_ALIAS("x15mod", "bitblock");
ALGO_ALIAS("x15", "bitblock");
ALGO_ALIAS("x15modold", "bitblockold");
ALGO_ALIAS("x15old", "bitblockold");
ALGO_ALIAS("nist5", "talkcoin-mod");
ALGO_ALIAS("keccak", "maxcoin");
@ -662,14 +666,20 @@ void set_algorithm(algorithm_t* algo, const char* newname_alias) @@ -662,14 +666,20 @@ void set_algorithm(algorithm_t* algo, const char* newname_alias)
{
const char* newname;
//load previous algorithm nfactor in case nfactor was applied before algorithm... or default to 10
uint8_t nfactor = ((algo->nfactor)?algo->nfactor:10);
uint8_t old_nfactor = ((algo->nfactor)?algo->nfactor:0);
uint8_t nfactor = 0;
newname = lookup_algorithm_alias(newname_alias, &nfactor);
if (!newname) newname = newname_alias;
if (!(newname = lookup_algorithm_alias(newname_alias, &nfactor)))
newname = newname_alias;
copy_algorithm_settings(algo, newname);
// use old nfactor if it was previously set and is different than the one set by alias
if ((old_nfactor > 0) && (old_nfactor != nfactor))
nfactor = old_nfactor;
// Doesn't matter for non-scrypt algorithms
if (nfactor > 0)
set_algorithm_nfactor(algo, nfactor);
}

Loading…
Cancel
Save