Add share cards
This commit is contained in:
51 files changed
+1193
-239
No files matched your search
+10
-10
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regtest smoke test for kamado-api — two phases:
|
||||
# Regtest smoke test for kamado-api, two phases:
|
||||
#
|
||||
# Phase 1 (always): log-inject path
|
||||
# Injects a "Solved and confirmed block N" line directly into the ckpool log
|
||||
# and verifies the full tailer → aggregator → bitcoind RPC enrichment → /api/blocks
|
||||
# chain. Quick, no ckpool binary needed.
|
||||
#
|
||||
# Phase 2 (auto): full stratum path — the complete revenue-critical path
|
||||
# Phase 2 (auto): full stratum path, the complete revenue-critical path
|
||||
# A Python stratum miner connects to ckpool, mines a real diff-1 SHA256d hash
|
||||
# using multiprocessing, submits the winning share, ckpool calls bitcoind
|
||||
# submitblock, logs "Solved and confirmed block N+1", and the kamado-api
|
||||
@@ -73,7 +73,7 @@ fi
|
||||
|
||||
[[ -n "${WORK_DIR:-}" ]] || WORK_DIR=$(mktemp -d)
|
||||
|
||||
# Locate or build ckpool — required for Phase 2.
|
||||
# Locate or build ckpool, required for Phase 2.
|
||||
# Priority: CKPOOL_BIN env var → PATH → cached build → build from source.
|
||||
CKPOOL_AVAILABLE=false
|
||||
CKPOOL_DIR="$SCRIPT_DIR/../ckpool"
|
||||
@@ -119,12 +119,12 @@ elif command -v gcc autoconf automake libtool pkg-config git >/dev/null 2>&1 \
|
||||
CKPOOL_AVAILABLE=true
|
||||
log "ckpool: build complete → $CKPOOL_BIN"
|
||||
else
|
||||
log "ckpool not found and build prerequisites missing — Phase 2 will be skipped"
|
||||
log "ckpool not found and build prerequisites missing, Phase 2 will be skipped"
|
||||
log " Missing one or more of: gcc, autoconf, automake, libtool, pkg-config, git, libzmq-dev"
|
||||
log " Or set CKPOOL_BIN=/path/to/ckpool to skip the build"
|
||||
fi
|
||||
|
||||
# Write the Python stratum miner — no build step needed; python3 is in PATH (checked above).
|
||||
# Write the Python stratum miner, no build step needed; python3 is in PATH (checked above).
|
||||
# The miner uses hashlib SHA256 midstate optimization + multiprocessing so it scales linearly
|
||||
# with CPU count. Diff-1 requires on average 2^32 ≈ 4.3B hashes; at ~1.5 MH/s per core this
|
||||
# takes ~43 minutes on a single core but ~3 minutes on 16 cores.
|
||||
@@ -268,7 +268,7 @@ def main():
|
||||
|
||||
while True:
|
||||
# Snapshot the job and en2 used to build this round's header.
|
||||
# These must match exactly what we submit to ckpool — if job is
|
||||
# These must match exactly what we submit to ckpool, if job is
|
||||
# updated mid-round we still submit against the header we actually mined.
|
||||
cur_job = job
|
||||
cur_en2 = en2_int.to_bytes(en2_size, 'little')
|
||||
@@ -427,7 +427,7 @@ touch "$CKPOOL_LOG"
|
||||
# Kill any stale processes from a previous run that bypassed cleanup (e.g.
|
||||
# killed with SIGKILL). Without this they hold the ports, the new processes
|
||||
# fail to bind, but the readiness health-checks see the old processes
|
||||
# and report "ready" — causing very confusing test failures.
|
||||
# and report "ready", causing very confusing test failures.
|
||||
log "clearing test ports from any prior stale run…"
|
||||
for _port in $BTC_RPC_PORT $KAMADO_PORT $STRATUM_PORT; do
|
||||
fuser -k -TERM "${_port}/tcp" 2>/dev/null || true
|
||||
@@ -470,7 +470,7 @@ for i in $(seq 1 30); do
|
||||
done
|
||||
$ready || die "bitcoind did not become ready within 30s (see $WORK_DIR/bitcoind.log)"
|
||||
kill -0 "$BITCOIN_PID" 2>/dev/null \
|
||||
|| die "bitcoind (pid $BITCOIN_PID) is not running — another process may have answered on port $BTC_RPC_PORT"
|
||||
|| die "bitcoind (pid $BITCOIN_PID) is not running, another process may have answered on port $BTC_RPC_PORT"
|
||||
log "bitcoind ready (pid $BITCOIN_PID)"
|
||||
|
||||
# Create a descriptor wallet and mine enough blocks for coinbase maturity.
|
||||
@@ -511,7 +511,7 @@ for i in $(seq 1 30); do
|
||||
done
|
||||
$ready || die "kamado-api did not become ready within 30s (see $WORK_DIR/kamado.log)"
|
||||
kill -0 "$KAMADO_PID" 2>/dev/null \
|
||||
|| die "kamado-api (pid $KAMADO_PID) is not running — port $KAMADO_PORT may already be in use"
|
||||
|| die "kamado-api (pid $KAMADO_PID) is not running, port $KAMADO_PORT may already be in use"
|
||||
log "kamado-api ready (pid $KAMADO_PID)"
|
||||
|
||||
# ============================================================
|
||||
@@ -619,7 +619,7 @@ for i in $(seq 1 30); do
|
||||
done
|
||||
$ready || die "ckpool stratum port did not open within 30s (see $WORK_DIR/ckpool-stderr.log)"
|
||||
kill -0 "$CKPOOL_PID" 2>/dev/null \
|
||||
|| die "ckpool (pid $CKPOOL_PID) is not running — check $WORK_DIR/ckpool-stderr.log"
|
||||
|| die "ckpool (pid $CKPOOL_PID) is not running, check $WORK_DIR/ckpool-stderr.log"
|
||||
log "ckpool ready (pid $CKPOOL_PID)"
|
||||
|
||||
# ---- run Python stratum miner in background ---------------------------------
|
||||
|
||||
Reference in new issue
Block a user