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;
gdata_t *gdata = ckp->data;
unix_msg_t *umsg = NULL;
connsock_t *cs = NULL;
bool started = false;
char *buf = NULL;
int ret = 0;
@ -2754,8 +2755,6 @@ reconnect:
clear_unix_msg(&umsg);
if (ckp->node) {
connsock_t *cs;
old_si = si;
si = live_server(ckp);
if (!si)
@ -2831,7 +2830,14 @@ retry:
} else if (cmdmatch(buf, "reconnect")) {
goto reconnect;
} else if (cmdmatch(buf, "submitblock:")) {
char blockmsg[80];
bool ret;
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")) {
sscanf(buf, "loglevel=%d", &ckp->loglevel);
} else if (cmdmatch(buf, "ping")) {

10
src/stratifier.c

@ -2270,6 +2270,11 @@ static void stratum_broadcast(sdata_t *sdata, json_t *val)
return;
}
if (ckp->node) {
json_decref(val);
return;
}
/* Use this locking as an opportunity to test other clients. */
ck_rlock(&ckp_sdata->instance_lock);
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;
json_t *val;
update_base(ckp, GEN_PRIORITY);
if (!ckp->node)
update_base(ckp, GEN_PRIORITY);
ts_realtime(&ts_now);
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);
/* Can't submit a block in proxy mode without the transactions */
if (wb->proxy && wb->merkles)
if (!ckp->node && wb->proxy)
return;
ts_realtime(&ts_now);

Loading…
Cancel
Save