|
|
@@ -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)
|
|
|
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[] = {
|
|
|
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)
|
|
|
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)
|
|
|
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)
|
|
|
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)
|
|
|
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)
|
|
|
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:
|
|
|
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)
|
|
|
} 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)
|
|
|
{
|
|
|
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)
|
|
|
}
|
|
|
|
|
|
/* 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)
|
|
|
} 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)
|
|
|
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)
|
|
|
|
|
|
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)
|
|
|
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)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- 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)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- 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:
|
|
|
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:
|
|
|
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:
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
-
|