Skip to content

Commit

Permalink
Switch to getwork if no payout address is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
pooler committed May 22, 2014
1 parent a7aa615 commit a988337
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,11 @@ static bool gbt_work_decode(const json_t *val, struct work *work)
} else {
int64_t cbvalue;
if (!pk_script_size) {
applog(LOG_ERR, "No payout address provided");
if (allow_getwork) {
applog(LOG_INFO, "No payout address provided, switching to getwork");
have_gbt = false;
} else
applog(LOG_ERR, "No payout address provided");
goto out;
}
tmp = json_object_get(val, "coinbasevalue");
Expand Down Expand Up @@ -796,9 +800,13 @@ static bool get_upstream_work(CURL *curl, struct work *work)
if (!val)
return false;

if (have_gbt)
if (have_gbt) {
rc = gbt_work_decode(json_object_get(val, "result"), work);
else
if (!have_gbt) {
json_decref(val);
goto start;
}
} else
rc = work_decode(json_object_get(val, "result"), work);

if (opt_debug && rc) {
Expand Down

0 comments on commit a988337

Please sign in to comment.