Browse Source

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.
nfactor-troky
Con Kolivas 13 years ago
parent
commit
82f74af533
  1. 17
      README
  2. 114
      cgminer.c
  3. 2
      example.conf

17
README

@ -4,8 +4,8 @@ monitoring, (over)clocking and fanspeed support for bitcoin and derivative @@ -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!
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
--donation feature or donate directly to the address below.
time so donations would be greatly appreciated. Please consider donating to the
address below.
Con Kolivas <kernel@kolivas.org>
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ
@ -126,7 +126,6 @@ Options for both config file and command line: @@ -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-gpu Automatically adjust all GPU engine clock speeds to maintain a target temperature
--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)
--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
@ -747,14 +746,6 @@ than whatever it is being packaged with. If you installed cgminer yourself, @@ -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
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
less of another, or can you change the quiet mode or can you add yet another
output mode?
@ -820,8 +811,8 @@ driver version and ATI stream version. @@ -820,8 +811,8 @@ driver version and ATI stream version.
---
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
--donation feature or donate directly to the address below.
time so donations would be greatly appreciated. Please consider donating to the
address below.
Con Kolivas <kernel@kolivas.org>
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ

114
cgminer.c

@ -176,9 +176,6 @@ unsigned int total_go, total_ro; @@ -176,9 +176,6 @@ unsigned int total_go, total_ro;
struct pool *pools[MAX_POOLS];
static struct pool *currentpool = NULL;
static float opt_donation = 0.0;
static struct pool donationpool;
int total_pools;
enum pool_strategy pool_strategy = POOL_FAILOVER;
int opt_rotate_period;
@ -404,18 +401,6 @@ static char *set_int_1_to_10(const char *arg, int *i) @@ -404,18 +401,6 @@ static char *set_int_1_to_10(const char *arg, int *i)
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
static char *add_serial(char *arg)
{
@ -627,11 +612,6 @@ static struct opt_table opt_config_table[] = { @@ -627,11 +612,6 @@ static struct opt_table opt_config_table[] = {
OPT_WITHOUT_ARG("--disable-gpu|-G",
opt_set_bool, &opt_nogpu,
"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))
OPT_WITHOUT_ARG("--enable-cpu|-C",
opt_set_bool, &opt_usecpu,
@ -1333,11 +1313,6 @@ bool regeneratehash(const struct work *work) @@ -1333,11 +1313,6 @@ bool regeneratehash(const struct work *work)
return false;
}
static bool donor(struct pool *pool)
{
return (pool == &donationpool);
}
static bool submit_upstream_work(const struct work *work)
{
char *hexstr = NULL;
@ -1394,14 +1369,11 @@ static bool submit_upstream_work(const struct work *work) @@ -1394,14 +1369,11 @@ static bool submit_upstream_work(const struct work *work)
if (!pool_tset(pool, &pool->submit_fail)) {
total_ro++;
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;
} else if (pool_tclear(pool, &pool->submit_fail)) {
if (!donor(pool))
applog(LOG_WARNING, "Pool %d communication resumed, submitting work", pool->pool_no);
}
} else if (pool_tclear(pool, &pool->submit_fail))
applog(LOG_WARNING, "Pool %d communication resumed, submitting work", pool->pool_no);
res = json_object_get(val, "result");
@ -1427,10 +1399,7 @@ static bool submit_upstream_work(const struct work *work) @@ -1427,10 +1399,7 @@ static bool submit_upstream_work(const struct work *work)
if (opt_debug)
applog(LOG_DEBUG, "PROOF OF WORK RESULT: true (yay!!!)");
if (!QUIET) {
if (donor(work->pool))
applog(LOG_NOTICE, "Accepted %s %s %d thread %d donate",
hashshow, cgpu->api->name, cgpu->device_id, thr_id);
else if (total_pools > 1)
if (total_pools > 1)
applog(LOG_NOTICE, "Accepted %s %s %d thread %d pool %d",
hashshow, cgpu->api->name, cgpu->device_id, thr_id, work->pool->pool_no);
else
@ -1449,10 +1418,7 @@ static bool submit_upstream_work(const struct work *work) @@ -1449,10 +1418,7 @@ static bool submit_upstream_work(const struct work *work)
if (opt_debug)
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
if (!QUIET) {
if (donor(work->pool))
applog(LOG_NOTICE, "Rejected %s %s %d thread %d donate",
hashshow, cgpu->api->name, cgpu->device_id, thr_id);
else if (total_pools > 1)
if (total_pools > 1)
applog(LOG_NOTICE, "Rejected %s %s %d thread %d pool %d",
hashshow, cgpu->api->name, cgpu->device_id, thr_id, work->pool->pool_no);
else
@ -1491,13 +1457,6 @@ static inline struct pool *select_pool(bool lagging) @@ -1491,13 +1457,6 @@ static inline struct pool *select_pool(bool lagging)
static int rotating_pool = 0;
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();
if (pool_strategy != POOL_LOADBALANCE && !lagging)
@ -1542,14 +1501,6 @@ retry: @@ -1542,14 +1501,6 @@ retry:
while (!val && retries++ < 3) {
val = json_rpc_call(curl, pool->rpc_url, pool->rpc_userpass, rpc_req,
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)) {
applog(LOG_DEBUG, "Failed json_rpc_call in get_upstream_work");
@ -1764,10 +1715,6 @@ static bool stale_work(struct work *work, bool share) @@ -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)
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)
ret = true;
return ret;
@ -2045,11 +1992,6 @@ static void test_work_current(struct work *work, bool longpoll) @@ -2045,11 +1992,6 @@ static void test_work_current(struct work *work, bool longpoll)
{
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);
if (unlikely(!hexstr)) {
applog(LOG_ERR, "stage_thread OOM");
@ -2303,7 +2245,6 @@ void write_config(FILE *fcfg) @@ -2303,7 +2245,6 @@ void write_config(FILE *fcfg)
}
/* Special case options */
fprintf(fcfg, ",\n\n\"donation\" : \"%.2f\"", opt_donation);
fprintf(fcfg, ",\n\"shares\" : \"%d\"", opt_shares);
if (pool_strategy == POOL_LOADBALANCE)
fputs(",\n\"load-balance\" : true", fcfg);
@ -2906,12 +2847,8 @@ static bool pool_active(struct pool *pool, bool pinging) @@ -2906,12 +2847,8 @@ static bool pool_active(struct pool *pool, bool pinging)
} else {
applog(LOG_DEBUG, "FAILED to retrieve work from pool %u %s",
pool->pool_no, pool->rpc_url);
if (!pinging) {
if (!donor(pool))
applog(LOG_WARNING, "Pool %u slow/down or URL or credentials invalid", pool->pool_no);
else
applog(LOG_WARNING, "Donor pool slow to respond");
}
if (!pinging)
applog(LOG_WARNING, "Pool %u slow/down or URL or credentials invalid", pool->pool_no);
}
curl_easy_cleanup(curl);
@ -2921,8 +2858,7 @@ static bool pool_active(struct pool *pool, bool pinging) @@ -2921,8 +2858,7 @@ static bool pool_active(struct pool *pool, bool pinging)
static void pool_died(struct pool *pool)
{
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);
switch_pools(NULL);
}
@ -2940,8 +2876,7 @@ static inline int cp_prio(void) @@ -2940,8 +2876,7 @@ static inline int cp_prio(void)
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)
switch_pools(NULL);
}
@ -3022,7 +2957,7 @@ static inline bool should_roll(struct work *work) @@ -3022,7 +2957,7 @@ static inline bool should_roll(struct work *work)
static inline bool can_roll(struct work *work)
{
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)
@ -3625,14 +3560,6 @@ static void *watchdog_thread(void *userdata) @@ -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) {
gettimeofday(&rotate_tv, NULL);
switch_pools(NULL);
@ -3818,9 +3745,6 @@ static void print_summary(void) @@ -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");
for (i = 0; i < total_devices; ++i) {
if (devices[i]->enabled)
@ -4378,19 +4302,6 @@ retry_pools: @@ -4378,19 +4302,6 @@ 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)
start_longpoll();
@ -4493,10 +4404,6 @@ retry_pools: @@ -4493,10 +4404,6 @@ retry_pools:
pthread_detach(thr->pth);
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 */
pthread_join(thr_info[work_thr_id].pth, NULL);
@ -4527,4 +4434,3 @@ retry_pools: @@ -4527,4 +4434,3 @@ retry_pools:
return 0;
}

2
example.conf

@ -27,7 +27,6 @@ @@ -27,7 +27,6 @@
"temp-overheat" : "85,85,85,85",
"temp-target" : "75,75,75,75",
"algo" : "sse2_64",
"auto-fan" : true,
"auto-gpu" : true,
"expiry" : "120",
@ -40,7 +39,6 @@ @@ -40,7 +39,6 @@
"temp-hysteresis" : "3",
"worksize" : "0",
"donation" : "1.00",
"shares" : "0",
"kernel-path" : "/usr/local/bin"
}
Loading…
Cancel
Save