20 lines
820 B
Bash
Executable File
20 lines
820 B
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')
|
|
|
|
if [ "$ibd" = "false" ] || [ "$blocks" -eq "$headers" ]; then
|
|
echo "Bitcoin ready: Synced ($blocks blocks)"
|
|
exit 0
|
|
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%"
|
|
exit 1
|
|
fi
|