Expose Block Broadcast Fallback config + plumb env through

New advanced.block-broadcast-fallback union:
  * enabled (default: false)
  * grace-seconds (default: 30, range 10-600)
  * backup-rpcs: list of full bitcoind RPC URLs, with inline
    credentials supported (https://user:pass@host:port/). Up to 10.

docker_entrypoint reads the list with yq, joins with newlines, and
exports BACKUP_RPC_URLS plus PENDING_BLOCKS_DIR=<logdir>/pending-blocks
and PENDING_BLOCKS_GRACE so kamado-api's blocksubmit watcher activates.
If the user enables the fallback but provides no URLs, we log a
warning and disable rather than spam pending-block warnings.

The companion ckpool patch (KamadoPool repo, 0004-dump-pending-block-
for-fallback) writes raw block hex to PENDING_BLOCKS_DIR before each
submit attempt and unlinks on success. The watcher only fires if
ckpool's primary submit fails AND the operator configured backup RPCs.
This commit is contained in:
satoshi
2026-04-27 21:26:50 +03:00
parent 4be06d347c
commit 1b67479a4d
2 changed files with 66 additions and 0 deletions
+24
View File
@@ -63,6 +63,30 @@ else
fi
export MEMPOOL_BASE_URL
# Block-broadcast fallback: if the user enabled the safety-net
# broadcaster AND provided at least one backup RPC URL, point
# kamado-api at the patched-ckpool sidecar dir and feed the URL list
# through. Empty PENDING_BLOCKS_DIR disables the watcher entirely.
FALLBACK_ENABLED=$(q '.advanced.block-broadcast-fallback.enabled // false')
if [[ "${FALLBACK_ENABLED}" == "true" ]]; then
# Newline-joined list — matches kamado-api's parser. q strips
# quotes via -r, and yq emits one entry per line for [] expansion.
BACKUP_RPC_URLS=$(q '.advanced.block-broadcast-fallback.backup-rpcs[]' 2>/dev/null || true)
if [[ -z "${BACKUP_RPC_URLS}" ]]; then
echo "Block-broadcast fallback enabled but no backup RPC URLs listed — disabling." >&2
export PENDING_BLOCKS_DIR=""
export BACKUP_RPC_URLS=""
else
# ckpool's patch writes hex files to <logdir>/pending-blocks.
export PENDING_BLOCKS_DIR="${LOGDIR}/pending-blocks"
export BACKUP_RPC_URLS
export PENDING_BLOCKS_GRACE=$(q '.advanced.block-broadcast-fallback.grace-seconds // 30')s
fi
else
export PENDING_BLOCKS_DIR=""
export BACKUP_RPC_URLS=""
fi
# CKPool-solo uses the worker's stratum username as the payout
# address and refuses to authenticate workers whose username is not
# a valid address on the active network. The conf `btcaddress` is