Skip to content

Commit

Permalink
Added random offset to start of dev pool switch to spread hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
brian112358 committed Mar 30, 2018
1 parent 44eb2e5 commit 1957ca3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ int opt_time_limit = -1;
int opt_shares_limit = -1;
time_t firstwork_time = 0;
time_t dev_timestamp;
time_t dev_timestamp_offset;
int opt_timeout = 300; // curl
int opt_scantime = 10;
static json_t *opt_config;
Expand Down Expand Up @@ -1808,7 +1809,7 @@ static bool is_dev_time() {
* dev_donate_percent * 0.01 + 2;
if(dev_portion < 12) // No point in bothering with less than 10s
return false;
return (time(NULL) - dev_timestamp) % DONATE_CYCLE_TIME
return (time(NULL) - dev_timestamp + dev_timestamp_offset) % DONATE_CYCLE_TIME
>= (DONATE_CYCLE_TIME - dev_portion);
}

Expand Down Expand Up @@ -4020,6 +4021,7 @@ int main(int argc, char *argv[])
struct pool_infos *p = &pools[num_pools-1];
p->type |= POOL_DONATE;
dev_timestamp = time(NULL);
dev_timestamp_offset = rand() % DONATE_CYCLE_TIME;
printf("Dev donation set to %.1f%%. Thanks for supporting this project!\n\n", dev_donate_percent);
}

Expand Down

0 comments on commit 1957ca3

Please sign in to comment.