Patch 9: fix shares being rejected after a pool restart bug

This commit is contained in:
satoshi committed 2026-09-01 23:53:06 +03:00
1 parent fc69410792
commit 4e40e08fd4
2 files changed
+120 -1

No files matched your search

+3 -1
View File
@@ -32,7 +32,7 @@ CKPool is a high-performance stratum server, but it has no web interface and lim
### Patches Applied to CKPool
Eight patches are applied to upstream commit `cfb0f83` (which itself includes the workbase_id fix, extended ESP32/NerdMiner timeouts, configurable `dropidle`, and vardiff improvements):
Nine patches are applied to upstream commit `cfb0f83` (which itself includes the workbase_id fix, extended ESP32/NerdMiner timeouts, configurable `dropidle`, and vardiff improvements):
| Patch | Purpose |
|-------|---------|
@@ -44,6 +44,7 @@ Eight patches are applied to upstream commit `cfb0f83` (which itself includes th
| `0006` | Expose raw reject count in pool stats |
| `0007` | Replace hardcoded "ckpool" branding in the coinbase scriptSig with "kamado" (same 6 bytes, consensus-safe) |
| `0008` | Log full PoW reproduction data (raw 80-byte header, coinbase, merkle branches) when a share sets a new best difficulty |
| `0009` | Send `mining.set_difficulty` before the first `mining.notify`, resume a reconnecting miner's tuned difficulty, and grant its first job a difficulty grace window |
### Middleware API
@@ -94,6 +95,7 @@ The Svelte 5 dashboard connects via WebSocket for real-time push updates (no pol
- **ckpool kill-on-failure** — When bitcoind becomes unreachable, kamado-api kills ckpool so miners can failover to another pool. ckpool restarts automatically when bitcoind recovers.
- **Deferred RPC** — Dashboard RPCs wait until the ckpool notifier completes on tip change to prioritize system resources for block reconstruction and validation.
- **Log cursor persistence** — The tailer's file offset is stored in SQLite so block-solve detection resumes correctly after restart.
- **Clean restarts for miners** — Upstream ckpool sends a reconnecting miner its first job *before* telling it the difficulty, and resets every client to the pool's `startdiff`, discarding what vardiff had tuned. Both produce a burst of "Above target" rejects on every pool restart. Patch `0009` sends `mining.set_difficulty` first, seeds the starting difficulty from the worker's retained hashrate, and accepts shares for the already-in-flight job down to the pool minimum until the next `mining.notify`.
- **Warm-up resilience** — The ckpool socket client handles transient EOFs during startup gracefully instead of crashing.
## API Reference