Browse Source

Submit blocks locally in node mode

master
Con Kolivas 9 years ago
parent
commit
135d2b84e7
  1. 10
      src/generator.c
  2. 10
      src/stratifier.c

10
src/generator.c

@ -2746,6 +2746,7 @@ static int proxy_loop(proc_instance_t *pi)
ckpool_t *ckp = pi->ckp; ckpool_t *ckp = pi->ckp;
gdata_t *gdata = ckp->data; gdata_t *gdata = ckp->data;
unix_msg_t *umsg = NULL; unix_msg_t *umsg = NULL;
connsock_t *cs = NULL;
bool started = false; bool started = false;
char *buf = NULL; char *buf = NULL;
int ret = 0; int ret = 0;
@ -2754,8 +2755,6 @@ reconnect:
clear_unix_msg(&umsg); clear_unix_msg(&umsg);
if (ckp->node) { if (ckp->node) {
connsock_t *cs;
old_si = si; old_si = si;
si = live_server(ckp); si = live_server(ckp);
if (!si) if (!si)
@ -2831,7 +2830,14 @@ retry:
} else if (cmdmatch(buf, "reconnect")) { } else if (cmdmatch(buf, "reconnect")) {
goto reconnect; goto reconnect;
} else if (cmdmatch(buf, "submitblock:")) { } else if (cmdmatch(buf, "submitblock:")) {
char blockmsg[80];
bool ret;
LOGNOTICE("Submitting likely block solve share to upstream pool"); LOGNOTICE("Submitting likely block solve share to upstream pool");
ret = submit_block(cs, buf + 12 + 64 + 1);
memset(buf + 12 + 64, 0, 1);
sprintf(blockmsg, "%sblock:%s", ret ? "" : "no", buf + 12);
send_proc(ckp->stratifier, blockmsg);
} else if (cmdmatch(buf, "loglevel")) { } else if (cmdmatch(buf, "loglevel")) {
sscanf(buf, "loglevel=%d", &ckp->loglevel); sscanf(buf, "loglevel=%d", &ckp->loglevel);
} else if (cmdmatch(buf, "ping")) { } else if (cmdmatch(buf, "ping")) {

10
src/stratifier.c

@ -2270,6 +2270,11 @@ static void stratum_broadcast(sdata_t *sdata, json_t *val)
return; return;
} }
if (ckp->node) {
json_decref(val);
return;
}
/* Use this locking as an opportunity to test other clients. */ /* Use this locking as an opportunity to test other clients. */
ck_rlock(&ckp_sdata->instance_lock); ck_rlock(&ckp_sdata->instance_lock);
HASH_ITER(hh, ckp_sdata->stratum_instances, client, tmp) { HASH_ITER(hh, ckp_sdata->stratum_instances, client, tmp) {
@ -2523,7 +2528,8 @@ static void block_solve(ckpool_t *ckp, const char *blockhash)
ts_t ts_now; ts_t ts_now;
json_t *val; json_t *val;
update_base(ckp, GEN_PRIORITY); if (!ckp->node)
update_base(ckp, GEN_PRIORITY);
ts_realtime(&ts_now); ts_realtime(&ts_now);
sprintf(cdfield, "%lu,%lu", ts_now.tv_sec, ts_now.tv_nsec); sprintf(cdfield, "%lu,%lu", ts_now.tv_sec, ts_now.tv_nsec);
@ -4569,7 +4575,7 @@ test_blocksolve(const stratum_instance_t *client, const workbase_t *wb, const uc
LOGWARNING("Possible block solve diff %f !", diff); LOGWARNING("Possible block solve diff %f !", diff);
/* Can't submit a block in proxy mode without the transactions */ /* Can't submit a block in proxy mode without the transactions */
if (wb->proxy && wb->merkles) if (!ckp->node && wb->proxy)
return; return;
ts_realtime(&ts_now); ts_realtime(&ts_now);

Loading…
Cancel
Save