Skip to content

Commit

Permalink
When the pool change the diff. Abort current mining and startover.
Browse files Browse the repository at this point in the history
  • Loading branch information
runestensland committed Sep 1, 2015
1 parent a6f8b12 commit bb57e78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ static void *miner_thread(void *userdata)
bool extrajob = false;
char s[16];
int rc = 0;
scan_abort_flag = false;

memset(&work, 0, sizeof(work)); // prevent work from being used uninitialized

Expand Down Expand Up @@ -1813,7 +1814,8 @@ static void *longpoll_thread(void *userdata)
json_decref(val);
goto out;
}
if (likely(val)) {
if (likely(val))
{
if (!opt_quiet) applog(LOG_INFO, "LONGPOLL detected new block");
soval = json_object_get(json_object_get(val, "result"), "submitold");
submit_old = soval ? json_is_true(soval) : false;
Expand Down
4 changes: 3 additions & 1 deletion util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,9 @@ static bool stratum_set_difficulty(struct stratum_ctx *sctx, json_t *params)
pthread_mutex_unlock(&sctx->work_lock);

/* store for api stats */
if (diff != global_diff) {
if (diff != global_diff)
{
scan_abort_flag = true;
global_diff = diff;
applog(LOG_WARNING, "Stratum difficulty set to %g", diff);
}
Expand Down

0 comments on commit bb57e78

Please sign in to comment.