diff --git a/README b/README index cb5ba00c..19c51702 100644 --- a/README +++ b/README @@ -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 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 */ @@ -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); }