Switch to getwork if no payout address is provided

This commit is contained in:
pooler 2014-05-22 12:10:08 +02:00
parent a7aa615b76
commit a988337f52

View file

@ -448,6 +448,10 @@ static bool gbt_work_decode(const json_t *val, struct work *work)
} else { } else {
int64_t cbvalue; int64_t cbvalue;
if (!pk_script_size) { if (!pk_script_size) {
if (allow_getwork) {
applog(LOG_INFO, "No payout address provided, switching to getwork");
have_gbt = false;
} else
applog(LOG_ERR, "No payout address provided"); applog(LOG_ERR, "No payout address provided");
goto out; goto out;
} }
@ -796,9 +800,13 @@ start:
if (!val) if (!val)
return false; return false;
if (have_gbt) if (have_gbt) {
rc = gbt_work_decode(json_object_get(val, "result"), work); 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); rc = work_decode(json_object_get(val, "result"), work);
if (opt_debug && rc) { if (opt_debug && rc) {