Add options for new cryptonight forks
This commit is contained in:
1 parent
cc8ac3f54d
commit
5b63be8239
3 files changed
+75
-5
No files matched your search
@@ -72,6 +72,9 @@ enum sha_algos {
|
||||
ALGO_WHIRLPOOLX,
|
||||
ALGO_WILDKECCAK,
|
||||
ALGO_ZR5,
|
||||
ALGO_MONERO,
|
||||
ALGO_GRAFT,
|
||||
ALGO_STELLITE,
|
||||
ALGO_AUTO,
|
||||
ALGO_COUNT
|
||||
};
|
||||
@@ -146,6 +149,9 @@ static const char *algo_names[] = {
|
||||
"whirlpoolx",
|
||||
"wildkeccak",
|
||||
"zr5",
|
||||
"monero",
|
||||
"graft",
|
||||
"stellite",
|
||||
"auto", /* reserved for multi algo */
|
||||
""
|
||||
};
|
||||
@@ -206,4 +212,29 @@ static inline int algo_to_int(char* arg)
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline int get_cryptonight_algo(int fork)
|
||||
{
|
||||
int algo = ALGO_COUNT;
|
||||
|
||||
switch (fork) {
|
||||
case 8:
|
||||
algo = ALGO_GRAFT;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
algo = ALGO_MONERO;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
algo = ALGO_STELLITE;
|
||||
break;
|
||||
|
||||
default:
|
||||
algo = ALGO_CRYPTONIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
return algo;
|
||||
}
|
||||
|
||||
#endif
|
||||
+43
-3
@@ -233,6 +233,8 @@ int opt_api_mcast_port = 4068;
|
||||
|
||||
bool opt_stratum_stats = false;
|
||||
|
||||
int cryptonight_fork = 1;
|
||||
|
||||
static char const usage[] = "\
|
||||
Usage: " PROGRAM_NAME " [OPTIONS]\n\
|
||||
Options:\n\
|
||||
@@ -245,7 +247,7 @@ Options:\n\
|
||||
blakecoin Fast Blake 256 (8 rounds)\n\
|
||||
bmw BMW 256\n\
|
||||
cryptolight AEON cryptonight (MEM/2)\n\
|
||||
cryptonight XMR cryptonight\n\
|
||||
cryptonight XMR cryptonight v1 (old)\n\
|
||||
c11/flax X11 variant\n\
|
||||
decred Decred Blake256\n\
|
||||
deep Deepcoin\n\
|
||||
@@ -253,6 +255,7 @@ Options:\n\
|
||||
dmd-gr Diamond-Groestl\n\
|
||||
fresh Freshcoin (shavite 80)\n\
|
||||
fugue256 Fuguecoin\n\
|
||||
graft Cryptonight v8\n\
|
||||
groestl Groestlcoin\n"
|
||||
#ifdef WITH_HEAVY_ALGO
|
||||
" heavy Heavycoin\n"
|
||||
@@ -267,6 +270,7 @@ Options:\n\
|
||||
lyra2v2 VertCoin\n\
|
||||
lyra2z ZeroCoin (3rd impl)\n\
|
||||
myr-gr Myriad-Groestl\n\
|
||||
monero XMR cryptonight v7 (new)\n\
|
||||
neoscrypt FeatherCoin, Phoenix, UFO...\n\
|
||||
nist5 NIST5 (TalkCoin)\n\
|
||||
penta Pentablake hash (5x Blake 512)\n\
|
||||
@@ -284,6 +288,7 @@ Options:\n\
|
||||
skein Skein SHA2 (Skeincoin)\n\
|
||||
skein2 Double Skein (Woodcoin)\n\
|
||||
skunk Skein Cube Fugue Streebog\n\
|
||||
stellite Cryptonight v3\n\
|
||||
s3 S3 (1Coin)\n\
|
||||
timetravel Machinecoin permuted x8\n\
|
||||
tribus Denarius\n\
|
||||
@@ -573,7 +578,13 @@ static bool get_blocktemplate(CURL *curl, struct work *work);
|
||||
|
||||
void get_currentalgo(char* buf, int sz)
|
||||
{
|
||||
snprintf(buf, sz, "%s", algo_names[opt_algo]);
|
||||
int algo = opt_algo;
|
||||
|
||||
if (algo == ALGO_CRYPTONIGHT) {
|
||||
algo = get_cryptonight_algo(cryptonight_fork);
|
||||
}
|
||||
|
||||
snprintf(buf, sz, "%s", algo_names[algo]);
|
||||
}
|
||||
|
||||
void format_hashrate(double hashrate, char *output)
|
||||
@@ -2375,7 +2386,13 @@ static void *miner_thread(void *userdata)
|
||||
rc = scanhash_cryptolight(thr_id, &work, max_nonce, &hashes_done);
|
||||
break;
|
||||
case ALGO_CRYPTONIGHT:
|
||||
rc = scanhash_cryptonight(thr_id, &work, max_nonce, &hashes_done);
|
||||
int variant = 0;
|
||||
|
||||
if (cryptonight_fork > 1) {
|
||||
variant = ((((unsigned char*)work->data)[0] >= cryptonight_fork) ? ((unsigned char*)work->data)[0] - cryptonight_fork + 1 : 0 );
|
||||
}
|
||||
|
||||
rc = scanhash_cryptonight(thr_id, &work, max_nonce, &hashes_done, variant);
|
||||
break;
|
||||
case ALGO_DECRED:
|
||||
rc = scanhash_decred(thr_id, &work, max_nonce, &hashes_done);
|
||||
@@ -3138,6 +3155,29 @@ void parse_arg(int key, char *arg)
|
||||
case ALGO_SCRYPT_JANE: opt_nfactor = 14; break;
|
||||
}
|
||||
}
|
||||
|
||||
//fix cryptonight
|
||||
switch (opt_algo) {
|
||||
case ALGO_MONERO:
|
||||
opt_algo = ALGO_CRYPTONIGHT;
|
||||
cryptonight_fork = 7;
|
||||
break;
|
||||
|
||||
case ALGO_GRAFT:
|
||||
opt_algo = ALGO_CRYPTONIGHT;
|
||||
cryptonight_fork = 8;
|
||||
break;
|
||||
|
||||
case ALGO_STELLITE:
|
||||
opt_algo = ALGO_CRYPTONIGHT;
|
||||
cryptonight_fork = 3;
|
||||
break;
|
||||
|
||||
case ALGO_CRYPTONIGHT:
|
||||
cryptonight_fork = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'b':
|
||||
p = strstr(arg, ":");
|
||||
|
||||
@@ -22,7 +22,7 @@ static uint32_t *d_ctx_b[MAX_GPUS];
|
||||
|
||||
static bool init[MAX_GPUS] = { 0 };
|
||||
|
||||
extern "C" int scanhash_cryptonight(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done)
|
||||
extern "C" int scanhash_cryptonight(int thr_id, struct work* work, uint32_t max_nonce, unsigned long *hashes_done, int variant)
|
||||
{
|
||||
int res = 0;
|
||||
uint32_t throughput = 0;
|
||||
@@ -30,7 +30,6 @@ extern "C" int scanhash_cryptonight(int thr_id, struct work* work, uint32_t max_
|
||||
uint32_t *ptarget = work->target;
|
||||
uint8_t *pdata = (uint8_t*) work->data;
|
||||
uint32_t *nonceptr = (uint32_t*) (&pdata[39]);
|
||||
int variant = ((uint8_t*)pdata)[0] >= 7 ? ((uint8_t*)pdata)[0] - 6 : 0;
|
||||
const uint32_t first_nonce = *nonceptr;
|
||||
uint32_t nonce = first_nonce;
|
||||
int dev_id = device_map[thr_id];
|
||||
|
||||
Reference in new issue
Block a user