LeCoffre Deployment 43a05a2742 clean
2025-09-25 12:19:35 +00:00

25 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Script de test de progression pour Bitcoin Signet
info=$(bitcoin-cli -signet -conf=/etc/bitcoin/bitcoin.conf getblockchaininfo 2>/dev/null || echo '{}')
blocks=$(echo "$info" | jq -r '.blocks // 0')
headers=$(echo "$info" | jq -r '.headers // 0')
ibd=$(echo "$info" | jq -r '.initialblockdownload // false')
verification_progress=$(echo "$info" | jq -r '.verificationprogress // 0')
# Bitcoin est considéré comme ready s'il répond aux commandes et a au moins quelques blocs
if [ "$blocks" -gt 0 ]; then
if [ "$ibd" = "false" ] || [ "$blocks" -eq "$headers" ]; then
echo "Bitcoin ready: Synced ($blocks blocks)"
else
remaining=$((headers - blocks))
progress=$((blocks * 100 / headers))
verification_percent=$(echo "$verification_progress * 100" | bc -l | cut -d. -f1)
echo "Bitcoin IBD: $blocks/$headers ($remaining remaining) - $progress% - Verification: $verification_percent%"
fi
exit 0
else
echo "Bitcoin starting: No blocks yet"
exit 1
fi