|
|
@ -530,13 +530,14 @@ static void add_base(ckpool_t *ckp, workbase_t *wb, bool *new_block) |
|
|
|
memcpy(lasthash, wb->prevhash, 65); |
|
|
|
memcpy(lasthash, wb->prevhash, 65); |
|
|
|
blockchange_id = wb->id; |
|
|
|
blockchange_id = wb->id; |
|
|
|
} |
|
|
|
} |
|
|
|
if (*new_block) { |
|
|
|
if (*new_block && ckp->logshares) { |
|
|
|
sprintf(wb->logdir, "%s%08x/", ckp->logdir, wb->height); |
|
|
|
sprintf(wb->logdir, "%s%08x/", ckp->logdir, wb->height); |
|
|
|
ret = mkdir(wb->logdir, 0750); |
|
|
|
ret = mkdir(wb->logdir, 0750); |
|
|
|
if (unlikely(ret && errno != EEXIST)) |
|
|
|
if (unlikely(ret && errno != EEXIST)) |
|
|
|
LOGERR("Failed to create log directory %s", wb->logdir); |
|
|
|
LOGERR("Failed to create log directory %s", wb->logdir); |
|
|
|
} |
|
|
|
} |
|
|
|
sprintf(wb->idstring, "%016lx", wb->id); |
|
|
|
sprintf(wb->idstring, "%016lx", wb->id); |
|
|
|
|
|
|
|
if (ckp->logshares) |
|
|
|
sprintf(wb->logdir, "%s%08x/%s", ckp->logdir, wb->height, wb->idstring); |
|
|
|
sprintf(wb->logdir, "%s%08x/%s", ckp->logdir, wb->height, wb->idstring); |
|
|
|
|
|
|
|
|
|
|
|
HASH_ITER(hh, workbases, tmp, tmpa) { |
|
|
|
HASH_ITER(hh, workbases, tmp, tmpa) { |
|
|
@ -1680,9 +1681,9 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg, |
|
|
|
char hexhash[68] = {}, sharehash[32], cdfield[64]; |
|
|
|
char hexhash[68] = {}, sharehash[32], cdfield[64]; |
|
|
|
enum share_err err = SE_NONE; |
|
|
|
enum share_err err = SE_NONE; |
|
|
|
ckpool_t *ckp = client->ckp; |
|
|
|
ckpool_t *ckp = client->ckp; |
|
|
|
|
|
|
|
char *fname = NULL, *s; |
|
|
|
char idstring[20]; |
|
|
|
char idstring[20]; |
|
|
|
uint32_t ntime32; |
|
|
|
uint32_t ntime32; |
|
|
|
char *fname, *s; |
|
|
|
|
|
|
|
workbase_t *wb; |
|
|
|
workbase_t *wb; |
|
|
|
uchar hash[32]; |
|
|
|
uchar hash[32]; |
|
|
|
int64_t id; |
|
|
|
int64_t id; |
|
|
@ -1836,6 +1837,7 @@ out_unlock: |
|
|
|
json_set_string(val, "workername", client->workername); |
|
|
|
json_set_string(val, "workername", client->workername); |
|
|
|
json_set_string(val, "username", client->user_instance->username); |
|
|
|
json_set_string(val, "username", client->user_instance->username); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ckp->logshares) { |
|
|
|
fp = fopen(fname, "a"); |
|
|
|
fp = fopen(fname, "a"); |
|
|
|
if (likely(fp)) { |
|
|
|
if (likely(fp)) { |
|
|
|
s = json_dumps(val, 0); |
|
|
|
s = json_dumps(val, 0); |
|
|
@ -1847,6 +1849,7 @@ out_unlock: |
|
|
|
LOGERR("Failed to fwrite to %s", fname); |
|
|
|
LOGERR("Failed to fwrite to %s", fname); |
|
|
|
} else |
|
|
|
} else |
|
|
|
LOGERR("Failed to fopen %s", fname); |
|
|
|
LOGERR("Failed to fopen %s", fname); |
|
|
|
|
|
|
|
} |
|
|
|
ckdbq_add(ckp, ID_SHARES, val); |
|
|
|
ckdbq_add(ckp, ID_SHARES, val); |
|
|
|
out: |
|
|
|
out: |
|
|
|
if (!share) { |
|
|
|
if (!share) { |
|
|
@ -1866,6 +1869,7 @@ out: |
|
|
|
ckdbq_add(ckp, ID_SHAREERR, val); |
|
|
|
ckdbq_add(ckp, ID_SHAREERR, val); |
|
|
|
LOGINFO("Invalid share from client %d: %s", client->id, client->workername); |
|
|
|
LOGINFO("Invalid share from client %d: %s", client->id, client->workername); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
free(fname); |
|
|
|
return json_boolean(result); |
|
|
|
return json_boolean(result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|