From f00856cd38e16d3700ea3a180d4687413a300742 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Thu, 11 Jun 2026 11:15:08 +1000 Subject: [PATCH 1/2] Append to logshares rather than overwriting --- src/stratifier.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index cd03e120..4a23934a 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -6366,10 +6366,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); } From 3e706e71a42e6c0b9258f916dcf1bdebf3c32605 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Thu, 11 Jun 2026 11:16:51 +1000 Subject: [PATCH 2/2] Log workbase information with -L --- README | 4 ++-- src/stratifier.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) 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 */