mirror of
https://github.com/Retropex/dockerfile-deps.git
synced 2025-05-13 00:40:41 +02:00
If peers data is corrupted, move it. (https://github.com/bitcoin/bitcoin/issues/26599)
This commit is contained in:
parent
c94a3ecd0b
commit
ba4e9c30c9
@ -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 "$@"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user