diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh index 9deb5a6..6b6c297 100755 --- a/docker_entrypoint.sh +++ b/docker_entrypoint.sh @@ -67,10 +67,21 @@ export POOL_BTCADDRESS="${SELFTEST_ADDRESS}" # SOCKET_DIR is ephemeral — sockets are re-created on each start. export LOGDIR=/root/.ckpool/logs export SOCKET_DIR=/run/ckpool -export BITCOIN_NOTIFY=true -# ckpool itself doesn't use ZMQ in this build — zmqblock is stripped -# from the rendered conf below. kamado-api subscribes separately. -export ZMQ_BLOCK="" + +# ckpool has TWO independent new-block detection paths. Wire up both +# so we're never blind to a tip change (every second of stale work +# in solo mode is hashrate burned on a dead block). +# +# 1. Blockpoll thread: polls bitcoind's getbestblockhash every +# BLOCKPOLL_MS. This only runs when notify=false — with +# notify=true the thread sleeps 5s and returns immediately. +# So keep notify=false. +# 2. ZMQ hashblock subscriber: instant push notifications from +# bitcoind. ckpool defaults zmqblock to tcp://127.0.0.1:28332 +# which is useless in this container, so point it at the real +# endpoint explicitly. +export BITCOIN_NOTIFY=false +export ZMQ_BLOCK="tcp://${BITCOIN_RPC_HOST}:28332" export BLOCKPOLL_MS=100 export UPDATE_INTERVAL_S=30 mkdir -p "${LOGDIR}" "${SOCKET_DIR}" /etc/ckpool @@ -98,7 +109,6 @@ sed \ -e "s|\${LOGDIR}|${LOGDIR}|g" \ -e "s|\${ZMQ_BLOCK}|${ZMQ_BLOCK}|g" \ "${TEMPLATE}" > "${CONF}" -sed -i '/"zmqblock":/d' "${CONF}" echo "kamado-entrypoint: starting ckpool (solo, ${BITCOIND_VARIANT}) on port ${STRATUM_PORT}" /usr/local/bin/ckpool --btcsolo --config "${CONF}" --sockdir "${SOCKET_DIR}" --log-shares &