diff --git a/Bitcoin/24.0.1/docker-entrypoint.sh b/Bitcoin/24.0.1/docker-entrypoint.sh index 4563222..fab1b1b 100755 --- a/Bitcoin/24.0.1/docker-entrypoint.sh +++ b/Bitcoin/24.0.1/docker-entrypoint.sh @@ -60,6 +60,20 @@ if [[ "$1" == "bitcoin-cli" || "$1" == "bitcoin-tx" || "$1" == "bitcoind" || "$1 ln -sfn "$BITCOIN_DATA" /home/bitcoin/.bitcoin chown -h bitcoin:bitcoin /home/bitcoin/.bitcoin rm -f /home/bitcoin/.bitcoin/settings.json + + # peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599 + peers_dat="/home/bitcoin/.bitcoin/peers.dat" + peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat" + if [[ -f "${peers_dat}" ]]; then + actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64) + expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32) + if [[ "${actual_hash}" != "${expected_hash}" ]]; then + echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}" + rm -f "${peers_dat_corrupted}" + mv "${peers_dat}" "${peers_dat_corrupted}" + fi + fi + exec gosu bitcoin "$@" else exec "$@" diff --git a/Bitcoin/24.0.1/linuxamd64.Dockerfile b/Bitcoin/24.0.1/linuxamd64.Dockerfile index a5f8158..34420a5 100644 --- a/Bitcoin/24.0.1/linuxamd64.Dockerfile +++ b/Bitcoin/24.0.1/linuxamd64.Dockerfile @@ -22,6 +22,9 @@ RUN set -ex \ FROM debian:bullseye-slim COPY --from=builder "/tmp/bin" /usr/local/bin +RUN apt-get update && \ + apt-get install -qq --no-install-recommends xxd && \ + rm -rf /var/lib/apt/lists/* RUN chmod +x /usr/local/bin/gosu && groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin # create data directory diff --git a/Bitcoin/24.0.1/linuxarm32v7.Dockerfile b/Bitcoin/24.0.1/linuxarm32v7.Dockerfile index 2020744..5f057a7 100644 --- a/Bitcoin/24.0.1/linuxarm32v7.Dockerfile +++ b/Bitcoin/24.0.1/linuxarm32v7.Dockerfile @@ -27,6 +27,9 @@ FROM arm32v7/debian:bullseye-slim COPY --from=builder "/tmp/bin" /usr/local/bin COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static +RUN apt-get update && \ + apt-get install -qq --no-install-recommends xxd && \ + rm -rf /var/lib/apt/lists/* RUN chmod +x /usr/local/bin/gosu && groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin # create data directory diff --git a/Bitcoin/24.0.1/linuxarm64v8.Dockerfile b/Bitcoin/24.0.1/linuxarm64v8.Dockerfile index 097be9f..8e03eae 100644 --- a/Bitcoin/24.0.1/linuxarm64v8.Dockerfile +++ b/Bitcoin/24.0.1/linuxarm64v8.Dockerfile @@ -27,6 +27,9 @@ FROM arm64v8/debian:bullseye-slim COPY --from=builder "/tmp/bin" /usr/local/bin COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static +RUN apt-get update && \ + apt-get install -qq --no-install-recommends xxd && \ + rm -rf /var/lib/apt/lists/* RUN chmod +x /usr/local/bin/gosu && groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin # create data directory