mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-01 01:14:22 +00:00
Fixed problem with stratum support when mining FC, GRS and TWE. Added --difficulty-multiplier parameter for controlling stratum difficulty multiplier.
This commit is contained in:
parent
769c9f8036
commit
7678db6801
21
sgminer.c
21
sgminer.c
@ -150,6 +150,7 @@ int opt_tcp_keepalive = 30;
|
||||
#else
|
||||
int opt_tcp_keepalive;
|
||||
#endif
|
||||
double opt_diff_mult = 1.0;
|
||||
|
||||
char *opt_kernel_path;
|
||||
char *sgminer_path;
|
||||
@ -1055,6 +1056,18 @@ static char *set_null(const char __maybe_unused *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *set_difficulty_multiplier(char *arg)
|
||||
{
|
||||
char **endptr = NULL;
|
||||
if (!(arg && arg[0]))
|
||||
return "Invalid parameters for set difficulty multiplier";
|
||||
opt_diff_mult = strtod(arg, endptr);
|
||||
if (opt_diff_mult == 0 || endptr == arg)
|
||||
return "Invalid value passed to set difficulty multiplier";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* These options are available from config file or commandline */
|
||||
static struct opt_table opt_config_table[] = {
|
||||
OPT_WITH_ARG("--api-allow",
|
||||
@ -1354,6 +1367,9 @@ static struct opt_table opt_config_table[] = {
|
||||
"Display extra work time debug information"),
|
||||
OPT_WITH_ARG("--pools",
|
||||
opt_set_bool, NULL, NULL, opt_hidden),
|
||||
OPT_WITH_ARG("--difficulty-multiplier",
|
||||
set_difficulty_multiplier, NULL, NULL,
|
||||
"Difficulty multiplier for jobs received from stratum pools"),
|
||||
OPT_ENDTABLE
|
||||
};
|
||||
|
||||
@ -5908,7 +5924,10 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
|
||||
cg_dwlock(&pool->data_lock);
|
||||
|
||||
/* Generate merkle root */
|
||||
gen_hash(pool->coinbase, merkle_root, pool->swork.cb_len);
|
||||
if (gpus[0].kernel == KL_FUGUECOIN || gpus[0].kernel == KL_GROESTLCOIN || gpus[0].kernel == KL_TWECOIN)
|
||||
sha256(pool->coinbase, pool->swork.cb_len, merkle_root);
|
||||
else
|
||||
gen_hash(pool->coinbase, merkle_root, pool->swork.cb_len);
|
||||
memcpy(merkle_sha, merkle_root, 32);
|
||||
for (i = 0; i < pool->swork.merkles; i++) {
|
||||
memcpy(merkle_sha + 32, pool->swork.merkle_bin[i], 32);
|
||||
|
5
util.c
5
util.c
@ -45,8 +45,7 @@
|
||||
#include "util.h"
|
||||
|
||||
#define DEFAULT_SOCKWAIT 60
|
||||
#define DM_SELECT(x, y, z) (dm_mode == DM_BITCOIN ? x : (dm_mode == DM_QUARKCOIN ? y : z))
|
||||
extern enum diff_calc_mode dm_mode;
|
||||
extern double opt_diff_mult;
|
||||
|
||||
bool successful_connect = false;
|
||||
static void keep_sockalive(SOCKETTYPE fd)
|
||||
@ -1644,7 +1643,7 @@ static bool parse_diff(struct pool *pool, json_t *val)
|
||||
{
|
||||
double old_diff, diff;
|
||||
|
||||
diff = json_number_value(json_array_get(val, 0)) * DM_SELECT(1, 256, 1);
|
||||
diff = json_number_value(json_array_get(val, 0)) * opt_diff_mult;
|
||||
if (diff == 0)
|
||||
return false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user