Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ down.
killing it if need be. Otherwise ckpool will refuse to start if an instance of
the same name is already running.

-L will log per share information in the logs directory divided by block height
and then workbase.
-L will log per share information and workbase information in the logs directory
divided by block height and then workbase.

-l <LOGLEVEL will change the log level to that specified. Default is 5 and
maximum debug is level 7.
Expand Down
17 changes: 14 additions & 3 deletions src/stratifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,18 @@ static void add_base(ckpool_t *ckp, sdata_t *sdata, workbase_t *wb, bool *new_bl
tv_time(&sdata->current_workbase->retired);
sdata->current_workbase = wb;

if (ckp->logshares) {
char *wifname;
json_t *wival;

ASPRINTF(&wifname, "%s.workinfo", wb->logdir);
wival = generate_workinfo(ckp, wb, __func__);
if (json_dump_file(wival, wifname, JSON_NO_UTF8 | JSON_PRESERVE_ORDER | JSON_COMPACT | JSON_EOL) == -1)
LOGERR("Failed to write to %s", wifname);
json_decref(wival);
dealloc(wifname);
}

/* Is this long enough to ensure we don't dereference a workbase
* immediately? Should be unless clock changes 10 minutes so we use
* ts_realtime */
Expand Down Expand Up @@ -6366,10 +6378,9 @@ static bool parse_submit(stratum_instance_t *client, yyjson_mut_val *params_val,
if (ckp->logshares) {
fp = fopen(fname, "ae");
if (likely(fp)) {
yyjson_mut_write_file(fname, doc, YYJSON_WRITE_NEWLINE_AT_END, NULL, NULL);
if (!yyjson_mut_write_fp(fp, doc, YYJSON_WRITE_NEWLINE_AT_END, NULL, NULL))
LOGERR("Failed to write to %s", fname);
fclose(fp);
if (unlikely(len < 0))
LOGERR("Failed to fwrite to %s", fname);
} else
LOGERR("Failed to fopen %s", fname);
}
Expand Down