Browse Source

Display workername in block solves

master
Con Kolivas 9 years ago
parent
commit
fa55ab48d8
  1. 12
      src/stratifier.c

12
src/stratifier.c

@ -1574,12 +1574,12 @@ static void reset_bestshares(sdata_t *sdata)
static void block_solve(ckpool_t *ckp, const char *blockhash) static void block_solve(ckpool_t *ckp, const char *blockhash)
{ {
ckmsg_t *block, *tmp, *found = NULL; ckmsg_t *block, *tmp, *found = NULL;
char *msg, *workername = NULL;
sdata_t *sdata = ckp->data; sdata_t *sdata = ckp->data;
char cdfield[64]; char cdfield[64];
int height = 0; int height = 0;
ts_t ts_now; ts_t ts_now;
json_t *val; json_t *val;
char *msg;
update_base(ckp, GEN_PRIORITY); update_base(ckp, GEN_PRIORITY);
@ -1598,6 +1598,7 @@ static void block_solve(ckpool_t *ckp, const char *blockhash)
} }
if (!strcmp(solvehash, blockhash)) { if (!strcmp(solvehash, blockhash)) {
dealloc(solvehash); dealloc(solvehash);
json_get_string(&workername, val, "workername");
found = block; found = block;
DL_DELETE(sdata->block_solves, block); DL_DELETE(sdata->block_solves, block);
break; break;
@ -1619,11 +1620,16 @@ static void block_solve(ckpool_t *ckp, const char *blockhash)
ckdbq_add(ckp, ID_BLOCK, val); ckdbq_add(ckp, ID_BLOCK, val);
free(found); free(found);
ASPRINTF(&msg, "Block %d solved by %s!", height, ckp->name); if (unlikely(!workername))
workername = strdup("");
ASPRINTF(&msg, "Block %d solved by %s @ %s!", height, workername, ckp->name);
stratum_broadcast_message(sdata, msg); stratum_broadcast_message(sdata, msg);
free(msg); free(msg);
LOGWARNING("Solved and confirmed block %d", height); LOGWARNING("Solved and confirmed block %d by %s", height, workername);
free(workername);
reset_bestshares(sdata); reset_bestshares(sdata);
} }

Loading…
Cancel
Save