mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 12:34:27 +00:00
Deprecate the --donation feature.
Needlessly complex, questionable usefulness, depends on author's server and a central pool of some kind, and was not heavily adopted.
This commit is contained in:
parent
488a3b7338
commit
82f74af533
17
README
17
README
@ -4,8 +4,8 @@ monitoring, (over)clocking and fanspeed support for bitcoin and derivative
|
|||||||
coins. Do not use on multiple block chains at the same time!
|
coins. Do not use on multiple block chains at the same time!
|
||||||
|
|
||||||
This code is provided entirely free of charge by the programmer in his spare
|
This code is provided entirely free of charge by the programmer in his spare
|
||||||
time so donations would be greatly appreciated. Please consider using the
|
time so donations would be greatly appreciated. Please consider donating to the
|
||||||
--donation feature or donate directly to the address below.
|
address below.
|
||||||
|
|
||||||
Con Kolivas <kernel@kolivas.org>
|
Con Kolivas <kernel@kolivas.org>
|
||||||
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ
|
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ
|
||||||
@ -126,7 +126,6 @@ Options for both config file and command line:
|
|||||||
--auto-fan Automatically adjust all GPU fan speeds to maintain a target temperature
|
--auto-fan Automatically adjust all GPU fan speeds to maintain a target temperature
|
||||||
--auto-gpu Automatically adjust all GPU engine clock speeds to maintain a target temperature
|
--auto-gpu Automatically adjust all GPU engine clock speeds to maintain a target temperature
|
||||||
--debug|-D Enable debug output
|
--debug|-D Enable debug output
|
||||||
--donation <arg> Set donation percentage to cgminer author (0.0 - 99.9) (default: 0.0)
|
|
||||||
--expiry|-E <arg> Upper bound on how many seconds after getting work we consider a share from it stale (default: 120)
|
--expiry|-E <arg> Upper bound on how many seconds after getting work we consider a share from it stale (default: 120)
|
||||||
--failover-only Don't leak work to backup pools when primary pool is lagging
|
--failover-only Don't leak work to backup pools when primary pool is lagging
|
||||||
--load-balance Change multipool strategy from failover to even load balance
|
--load-balance Change multipool strategy from failover to even load balance
|
||||||
@ -747,14 +746,6 @@ than whatever it is being packaged with. If you installed cgminer yourself,
|
|||||||
then you do not have a virus on your computer. Complain to your antivirus
|
then you do not have a virus on your computer. Complain to your antivirus
|
||||||
software company.
|
software company.
|
||||||
|
|
||||||
Q: How does the donation feature work and how does it affect my shares?
|
|
||||||
A: The donation feature is disabled by default and only does anything once
|
|
||||||
enabled. It queries the author's website for login credentials and contributes
|
|
||||||
up to a proportion of work to the author's account. While the overall
|
|
||||||
accepted/rejected rates will include this work, none of these will appear in
|
|
||||||
your own accounts. On exiting, the summary will tell you how many shares were
|
|
||||||
contributed to the author.
|
|
||||||
|
|
||||||
Q: Can you modify the display to include more of one thing in the output and
|
Q: Can you modify the display to include more of one thing in the output and
|
||||||
less of another, or can you change the quiet mode or can you add yet another
|
less of another, or can you change the quiet mode or can you add yet another
|
||||||
output mode?
|
output mode?
|
||||||
@ -820,8 +811,8 @@ driver version and ATI stream version.
|
|||||||
---
|
---
|
||||||
|
|
||||||
This code is provided entirely free of charge by the programmer in his spare
|
This code is provided entirely free of charge by the programmer in his spare
|
||||||
time so donations would be greatly appreciated. Please consider using the
|
time so donations would be greatly appreciated. Please consider donating to the
|
||||||
--donation feature or donate directly to the address below.
|
address below.
|
||||||
|
|
||||||
Con Kolivas <kernel@kolivas.org>
|
Con Kolivas <kernel@kolivas.org>
|
||||||
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ
|
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ
|
||||||
|
114
cgminer.c
114
cgminer.c
@ -176,9 +176,6 @@ unsigned int total_go, total_ro;
|
|||||||
struct pool *pools[MAX_POOLS];
|
struct pool *pools[MAX_POOLS];
|
||||||
static struct pool *currentpool = NULL;
|
static struct pool *currentpool = NULL;
|
||||||
|
|
||||||
static float opt_donation = 0.0;
|
|
||||||
static struct pool donationpool;
|
|
||||||
|
|
||||||
int total_pools;
|
int total_pools;
|
||||||
enum pool_strategy pool_strategy = POOL_FAILOVER;
|
enum pool_strategy pool_strategy = POOL_FAILOVER;
|
||||||
int opt_rotate_period;
|
int opt_rotate_period;
|
||||||
@ -404,18 +401,6 @@ static char *set_int_1_to_10(const char *arg, int *i)
|
|||||||
return set_int_range(arg, i, 1, 10);
|
return set_int_range(arg, i, 1, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *set_float_0_to_99(const char *arg, float *f)
|
|
||||||
{
|
|
||||||
char *err = opt_set_floatval(arg, f);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
if (*f < 0.0 || *f > 99.9)
|
|
||||||
return "Value out of range";
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_BITFORCE
|
#ifdef USE_BITFORCE
|
||||||
static char *add_serial(char *arg)
|
static char *add_serial(char *arg)
|
||||||
{
|
{
|
||||||
@ -627,11 +612,6 @@ static struct opt_table opt_config_table[] = {
|
|||||||
OPT_WITHOUT_ARG("--disable-gpu|-G",
|
OPT_WITHOUT_ARG("--disable-gpu|-G",
|
||||||
opt_set_bool, &opt_nogpu,
|
opt_set_bool, &opt_nogpu,
|
||||||
"Disable GPU mining even if suitable devices exist"),
|
"Disable GPU mining even if suitable devices exist"),
|
||||||
#endif
|
|
||||||
OPT_WITH_ARG("--donation",
|
|
||||||
set_float_0_to_99, &opt_show_floatval, &opt_donation,
|
|
||||||
"Set donation percentage to cgminer author (0.0 - 99.9)"),
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
#if defined(WANT_CPUMINE) && (defined(HAVE_OPENCL) || defined(USE_BITFORCE))
|
#if defined(WANT_CPUMINE) && (defined(HAVE_OPENCL) || defined(USE_BITFORCE))
|
||||||
OPT_WITHOUT_ARG("--enable-cpu|-C",
|
OPT_WITHOUT_ARG("--enable-cpu|-C",
|
||||||
opt_set_bool, &opt_usecpu,
|
opt_set_bool, &opt_usecpu,
|
||||||
@ -1333,11 +1313,6 @@ bool regeneratehash(const struct work *work)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool donor(struct pool *pool)
|
|
||||||
{
|
|
||||||
return (pool == &donationpool);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool submit_upstream_work(const struct work *work)
|
static bool submit_upstream_work(const struct work *work)
|
||||||
{
|
{
|
||||||
char *hexstr = NULL;
|
char *hexstr = NULL;
|
||||||
@ -1394,14 +1369,11 @@ static bool submit_upstream_work(const struct work *work)
|
|||||||
if (!pool_tset(pool, &pool->submit_fail)) {
|
if (!pool_tset(pool, &pool->submit_fail)) {
|
||||||
total_ro++;
|
total_ro++;
|
||||||
pool->remotefail_occasions++;
|
pool->remotefail_occasions++;
|
||||||
if (!donor(pool))
|
applog(LOG_WARNING, "Pool %d communication failure, caching submissions", pool->pool_no);
|
||||||
applog(LOG_WARNING, "Pool %d communication failure, caching submissions", pool->pool_no);
|
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
} else if (pool_tclear(pool, &pool->submit_fail)) {
|
} else if (pool_tclear(pool, &pool->submit_fail))
|
||||||
if (!donor(pool))
|
applog(LOG_WARNING, "Pool %d communication resumed, submitting work", pool->pool_no);
|
||||||
applog(LOG_WARNING, "Pool %d communication resumed, submitting work", pool->pool_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
res = json_object_get(val, "result");
|
res = json_object_get(val, "result");
|
||||||
|
|
||||||
@ -1427,10 +1399,7 @@ static bool submit_upstream_work(const struct work *work)
|
|||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
|
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
|
||||||
if (!QUIET) {
|
if (!QUIET) {
|
||||||
if (donor(work->pool))
|
if (total_pools > 1)
|
||||||
applog(LOG_NOTICE, "Accepted %s %s %d thread %d donate",
|
|
||||||
hashshow, cgpu->api->name, cgpu->device_id, thr_id);
|
|
||||||
else if (total_pools > 1)
|
|
||||||
applog(LOG_NOTICE, "Accepted %s %s %d thread %d pool %d",
|
applog(LOG_NOTICE, "Accepted %s %s %d thread %d pool %d",
|
||||||
hashshow, cgpu->api->name, cgpu->device_id, thr_id, work->pool->pool_no);
|
hashshow, cgpu->api->name, cgpu->device_id, thr_id, work->pool->pool_no);
|
||||||
else
|
else
|
||||||
@ -1449,10 +1418,7 @@ static bool submit_upstream_work(const struct work *work)
|
|||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
|
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
|
||||||
if (!QUIET) {
|
if (!QUIET) {
|
||||||
if (donor(work->pool))
|
if (total_pools > 1)
|
||||||
applog(LOG_NOTICE, "Rejected %s %s %d thread %d donate",
|
|
||||||
hashshow, cgpu->api->name, cgpu->device_id, thr_id);
|
|
||||||
else if (total_pools > 1)
|
|
||||||
applog(LOG_NOTICE, "Rejected %s %s %d thread %d pool %d",
|
applog(LOG_NOTICE, "Rejected %s %s %d thread %d pool %d",
|
||||||
hashshow, cgpu->api->name, cgpu->device_id, thr_id, work->pool->pool_no);
|
hashshow, cgpu->api->name, cgpu->device_id, thr_id, work->pool->pool_no);
|
||||||
else
|
else
|
||||||
@ -1491,13 +1457,6 @@ static inline struct pool *select_pool(bool lagging)
|
|||||||
static int rotating_pool = 0;
|
static int rotating_pool = 0;
|
||||||
struct pool *pool, *cp;
|
struct pool *pool, *cp;
|
||||||
|
|
||||||
if (total_getworks && opt_donation > 0.0 && !donationpool.idle &&
|
|
||||||
(float)donationpool.getwork_requested / (float)total_getworks < opt_donation / 100) {
|
|
||||||
if (!lagging)
|
|
||||||
return &donationpool;
|
|
||||||
lagging = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cp = current_pool();
|
cp = current_pool();
|
||||||
|
|
||||||
if (pool_strategy != POOL_LOADBALANCE && !lagging)
|
if (pool_strategy != POOL_LOADBALANCE && !lagging)
|
||||||
@ -1542,14 +1501,6 @@ retry:
|
|||||||
while (!val && retries++ < 3) {
|
while (!val && retries++ < 3) {
|
||||||
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
|
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
|
||||||
false, false, &work->rolltime, pool, false);
|
false, false, &work->rolltime, pool, false);
|
||||||
if (donor(pool) && !val) {
|
|
||||||
if (opt_debug)
|
|
||||||
applog(LOG_DEBUG, "Donor pool lagging");
|
|
||||||
pool = select_pool(true);
|
|
||||||
if (opt_debug)
|
|
||||||
applog(LOG_DEBUG, "DBG: sending %s get RPC call: %s", pool->rpc_url, rpc_req);
|
|
||||||
retries = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (unlikely(!val)) {
|
if (unlikely(!val)) {
|
||||||
applog(LOG_DEBUG, "Failed json_rpc_call in get_upstream_work");
|
applog(LOG_DEBUG, "Failed json_rpc_call in get_upstream_work");
|
||||||
@ -1764,10 +1715,6 @@ static bool stale_work(struct work *work, bool share)
|
|||||||
} else if ((now.tv_sec - work->tv_staged.tv_sec) >= opt_scantime)
|
} else if ((now.tv_sec - work->tv_staged.tv_sec) >= opt_scantime)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Don't compare donor work in case it's on a different chain */
|
|
||||||
if (donor(work->pool))
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (work->work_block != work_block)
|
if (work->work_block != work_block)
|
||||||
ret = true;
|
ret = true;
|
||||||
return ret;
|
return ret;
|
||||||
@ -2045,11 +1992,6 @@ static void test_work_current(struct work *work, bool longpoll)
|
|||||||
{
|
{
|
||||||
char *hexstr;
|
char *hexstr;
|
||||||
|
|
||||||
/* Allow donation to not set current work, so it will work even if
|
|
||||||
* mining on a different chain */
|
|
||||||
if (donor(work->pool))
|
|
||||||
return;
|
|
||||||
|
|
||||||
hexstr = bin2hex(work->data, 18);
|
hexstr = bin2hex(work->data, 18);
|
||||||
if (unlikely(!hexstr)) {
|
if (unlikely(!hexstr)) {
|
||||||
applog(LOG_ERR, "stage_thread OOM");
|
applog(LOG_ERR, "stage_thread OOM");
|
||||||
@ -2303,7 +2245,6 @@ void write_config(FILE *fcfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Special case options */
|
/* Special case options */
|
||||||
fprintf(fcfg, ",\n\n\"donation\" : \"%.2f\"", opt_donation);
|
|
||||||
fprintf(fcfg, ",\n\"shares\" : \"%d\"", opt_shares);
|
fprintf(fcfg, ",\n\"shares\" : \"%d\"", opt_shares);
|
||||||
if (pool_strategy == POOL_LOADBALANCE)
|
if (pool_strategy == POOL_LOADBALANCE)
|
||||||
fputs(",\n\"load-balance\" : true", fcfg);
|
fputs(",\n\"load-balance\" : true", fcfg);
|
||||||
@ -2906,12 +2847,8 @@ static bool pool_active(struct pool *pool, bool pinging)
|
|||||||
} else {
|
} else {
|
||||||
applog(LOG_DEBUG, "FAILED to retrieve work from pool %u %s",
|
applog(LOG_DEBUG, "FAILED to retrieve work from pool %u %s",
|
||||||
pool->pool_no, pool->rpc_url);
|
pool->pool_no, pool->rpc_url);
|
||||||
if (!pinging) {
|
if (!pinging)
|
||||||
if (!donor(pool))
|
applog(LOG_WARNING, "Pool %u slow/down or URL or credentials invalid", pool->pool_no);
|
||||||
applog(LOG_WARNING, "Pool %u slow/down or URL or credentials invalid", pool->pool_no);
|
|
||||||
else
|
|
||||||
applog(LOG_WARNING, "Donor pool slow to respond");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
@ -2921,8 +2858,7 @@ static bool pool_active(struct pool *pool, bool pinging)
|
|||||||
static void pool_died(struct pool *pool)
|
static void pool_died(struct pool *pool)
|
||||||
{
|
{
|
||||||
if (!pool_tset(pool, &pool->idle)) {
|
if (!pool_tset(pool, &pool->idle)) {
|
||||||
if (!donor(pool))
|
applog(LOG_WARNING, "Pool %d %s not responding!", pool->pool_no, pool->rpc_url);
|
||||||
applog(LOG_WARNING, "Pool %d %s not responding!", pool->pool_no, pool->rpc_url);
|
|
||||||
gettimeofday(&pool->tv_idle, NULL);
|
gettimeofday(&pool->tv_idle, NULL);
|
||||||
switch_pools(NULL);
|
switch_pools(NULL);
|
||||||
}
|
}
|
||||||
@ -2940,8 +2876,7 @@ static inline int cp_prio(void)
|
|||||||
|
|
||||||
static void pool_resus(struct pool *pool)
|
static void pool_resus(struct pool *pool)
|
||||||
{
|
{
|
||||||
if (!donor(pool))
|
applog(LOG_WARNING, "Pool %d %s recovered", pool->pool_no, pool->rpc_url);
|
||||||
applog(LOG_WARNING, "Pool %d %s recovered", pool->pool_no, pool->rpc_url);
|
|
||||||
if (pool->prio < cp_prio() && pool_strategy == POOL_FAILOVER)
|
if (pool->prio < cp_prio() && pool_strategy == POOL_FAILOVER)
|
||||||
switch_pools(NULL);
|
switch_pools(NULL);
|
||||||
}
|
}
|
||||||
@ -3022,7 +2957,7 @@ static inline bool should_roll(struct work *work)
|
|||||||
static inline bool can_roll(struct work *work)
|
static inline bool can_roll(struct work *work)
|
||||||
{
|
{
|
||||||
return (work->pool && !stale_work(work, false) && work->rolltime &&
|
return (work->pool && !stale_work(work, false) && work->rolltime &&
|
||||||
work->rolls < 11 && !work->clone && !donor(work->pool));
|
work->rolls < 11 && !work->clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void roll_work(struct work *work)
|
static void roll_work(struct work *work)
|
||||||
@ -3625,14 +3560,6 @@ static void *watchdog_thread(void *userdata)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_donation > 0.0) {
|
|
||||||
if (donationpool.idle && now.tv_sec - donationpool.tv_idle.tv_sec > 60) {
|
|
||||||
gettimeofday(&donationpool.tv_idle, NULL);
|
|
||||||
if (pool_active(&donationpool, true) && pool_tclear(&donationpool, &donationpool.idle))
|
|
||||||
pool_resus(&donationpool);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pool_strategy == POOL_ROTATE && now.tv_sec - rotate_tv.tv_sec > 60 * opt_rotate_period) {
|
if (pool_strategy == POOL_ROTATE && now.tv_sec - rotate_tv.tv_sec > 60 * opt_rotate_period) {
|
||||||
gettimeofday(&rotate_tv, NULL);
|
gettimeofday(&rotate_tv, NULL);
|
||||||
switch_pools(NULL);
|
switch_pools(NULL);
|
||||||
@ -3818,9 +3745,6 @@ static void print_summary(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_donation > 0.0)
|
|
||||||
applog(LOG_WARNING, "Donated share submissions: %d\n", donationpool.accepted + donationpool.rejected);
|
|
||||||
|
|
||||||
applog(LOG_WARNING, "Summary of per device statistics:\n");
|
applog(LOG_WARNING, "Summary of per device statistics:\n");
|
||||||
for (i = 0; i < total_devices; ++i) {
|
for (i = 0; i < total_devices; ++i) {
|
||||||
if (devices[i]->enabled)
|
if (devices[i]->enabled)
|
||||||
@ -4378,19 +4302,6 @@ retry_pools:
|
|||||||
goto retry_pools;
|
goto retry_pools;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_donation > 0.0) {
|
|
||||||
if (!get_dondata(&donationpool.rpc_url, &donationpool.rpc_userpass))
|
|
||||||
opt_donation = 0.0;
|
|
||||||
else {
|
|
||||||
if (unlikely(pthread_mutex_init(&donationpool.pool_lock, NULL)))
|
|
||||||
quit (1, "Failed to pthread_mutex_init in add donpool");
|
|
||||||
donationpool.enabled = true;
|
|
||||||
donationpool.pool_no = MAX_POOLS;
|
|
||||||
if (!pool_active(&donationpool, false))
|
|
||||||
donationpool.idle = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (want_longpoll)
|
if (want_longpoll)
|
||||||
start_longpoll();
|
start_longpoll();
|
||||||
|
|
||||||
@ -4493,10 +4404,6 @@ retry_pools:
|
|||||||
pthread_detach(thr->pth);
|
pthread_detach(thr->pth);
|
||||||
|
|
||||||
sleep(opt_log_interval);
|
sleep(opt_log_interval);
|
||||||
if (opt_donation > 0.0)
|
|
||||||
applog(LOG_WARNING, "Donation is enabled at %.1f%% thank you :-)", opt_donation);
|
|
||||||
else
|
|
||||||
applog(LOG_WARNING, "--donation is disabled, please consider just 0.5%% :-(");
|
|
||||||
|
|
||||||
/* main loop - simply wait for workio thread to exit */
|
/* main loop - simply wait for workio thread to exit */
|
||||||
pthread_join(thr_info[work_thr_id].pth, NULL);
|
pthread_join(thr_info[work_thr_id].pth, NULL);
|
||||||
@ -4527,4 +4434,3 @@ retry_pools:
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
"temp-overheat" : "85,85,85,85",
|
"temp-overheat" : "85,85,85,85",
|
||||||
"temp-target" : "75,75,75,75",
|
"temp-target" : "75,75,75,75",
|
||||||
|
|
||||||
"algo" : "sse2_64",
|
|
||||||
"auto-fan" : true,
|
"auto-fan" : true,
|
||||||
"auto-gpu" : true,
|
"auto-gpu" : true,
|
||||||
"expiry" : "120",
|
"expiry" : "120",
|
||||||
@ -40,7 +39,6 @@
|
|||||||
"temp-hysteresis" : "3",
|
"temp-hysteresis" : "3",
|
||||||
"worksize" : "0",
|
"worksize" : "0",
|
||||||
|
|
||||||
"donation" : "1.00",
|
|
||||||
"shares" : "0",
|
"shares" : "0",
|
||||||
"kernel-path" : "/usr/local/bin"
|
"kernel-path" : "/usr/local/bin"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user