Add share cards

This commit is contained in:
satoshi committed 2026-09-04 00:54:26 +03:00
1 parent ec42ce9b54
commit 4669bf10c0
51 files changed
+1193 -239

No files matched your search

@@ -5,15 +5,15 @@ index 7940d4fa..a856b3eb 100644
@@ -5865,6 +5865,65 @@ out_nouserwb:
return wb->coinb2bin;
}
+/* Kamado (patches/0008): highest share diff for which PoW reproduction
+ * data has been logged in this process run. Deliberately unlocked — a
+ * data has been logged in this process run. Deliberately unlocked, a
+ * race between share-processing threads can at worst emit a duplicate
+ * or out-of-order log line, which kamado-api deduplicates by diff. */
+static double best_pow_diff;
+
+/* Kamado (patches/0008): log everything needed to independently
+ * reproduce and verify the proof of work of a best share — the
+ * reproduce and verify the proof of work of a best share, the
+ * serialized 80-byte block header exactly as it was hashed, plus the
+ * assembled coinbase transaction and merkle branch hashes that
+ * reproduce the merkle root committed in that header. kamado-api
@@ -56,7 +56,7 @@ index 7940d4fa..a856b3eb 100644
+ if (likely(s)) {
+ /* Call logmsg directly rather than LOGNOTICE: the LOGMSG
+ * macro splits messages into DEFLOGBUFSIZ (512-byte) chunks,
+ * each written as a separate timestamped log line — and its
+ * each written as a separate timestamped log line, and its
+ * length arithmetic drops everything past ~3 chunks. This
+ * record is ~2.5KB of JSON that kamado-api must read back as
+ * one intact line. logmsg itself is unbounded. */
@@ -71,13 +71,13 @@ index 7940d4fa..a856b3eb 100644
@@ -5937,6 +5996,19 @@ static double submission_diff(sdata_t *sdata, const stratum_instance_t *client,
/* Calculate the diff of the share here */
ret = diff_from_target(hash);
+ /* Kamado (patches/0008): if this is the highest-diff share this
+ * process has seen, log full PoW reproduction data for the
+ * dashboard's best-share header inspector. Skip shares that will
+ * be rejected: stale ones, and those outside the ntime roll
+ * window (mirrors the check in parse_submit). Duplicates cannot
+ * trigger this — an identical share has an equal, not greater,
+ * trigger this, an identical share has an equal, not greater,
+ * diff. */
+ if (unlikely(ret > best_pow_diff && !stale &&
+ ntime32 >= wb->ntime32 && ntime32 <= wb->ntime32 + 7000)) {
@@ -87,4 +87,4 @@ index 7940d4fa..a856b3eb 100644
+
/* Test we haven't solved a block regardless of share status */
test_blocksolve(client, wb, swap, hash, ret, coinbase, cblen, nonce2, nonce, ntime32, version_mask, stale);