mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-25 11:13:12 +02:00
blockchain screen
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
# gets called when user logins per SSH
|
||||
# or calls 'raspiblitz' on the terminal
|
||||
#######################################
|
||||
echo "Starting SSH user interface ..."
|
||||
echo "Starting SSH user interface ... (please wait)"
|
||||
|
||||
# CONFIGFILE - configuration of RaspiBlitz
|
||||
configFile="/mnt/hdd/raspiblitz.conf"
|
||||
@@ -47,6 +47,7 @@ sudo chmod 740 /var/cache/raspiblitz/raspiblitz.status
|
||||
#####################################
|
||||
|
||||
exitMenuLoop=0
|
||||
doneIBD=0
|
||||
while [ ${exitMenuLoop} -eq 0 ]
|
||||
do
|
||||
|
||||
@@ -97,6 +98,20 @@ do
|
||||
state="starting"
|
||||
fi
|
||||
|
||||
#####################################
|
||||
# INITIAL BLOCKCHAIN SYNC
|
||||
#####################################
|
||||
if [ "${setupPhase}" == "done" ] && [ "${state}" == "ready" ] && [ ${doneIBD} -eq 0 ]; then
|
||||
# check if initial Blockchain sync is in progress
|
||||
echo "Gathering Info ... (please wait)"
|
||||
source <(sudo /home/admin/config.scripts/blitz.statusscan.sh)
|
||||
if [ "${syncedToChain}" == "0" ]; then
|
||||
|
||||
fi
|
||||
doneIBD=1
|
||||
fi
|
||||
|
||||
|
||||
#####################################
|
||||
# MAIN MENU or BLOCKCHAIN SYNC
|
||||
#####################################
|
||||
|
83
home.admin/setup.scripts/eventBlockchainSync.sh
Normal file
83
home.admin/setup.scripts/eventBlockchainSync.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
# this is an dialog that handles all UI events during setup that require a "info & wait" with no interaction
|
||||
|
||||
# get basic system information
|
||||
# these are the same set of infos the WebGUI dialog/controler has
|
||||
source /home/admin/_version.info
|
||||
source /home/admin/raspiblitz.info
|
||||
|
||||
# 1st PARAMETER: ssh|lcd
|
||||
lcd=0
|
||||
if [ "$1" == "lcd" ]; then
|
||||
lcd=1
|
||||
fi
|
||||
|
||||
# 2nd PARAMETER (optional): -loop-until-synced
|
||||
loopUntilSynced=0
|
||||
if [ "$2" == "-loop-until-synced" ]; then
|
||||
loopUntilSynced=1
|
||||
fi
|
||||
|
||||
loop=1
|
||||
while [ ${loop} -eq 1 ]
|
||||
do
|
||||
|
||||
# get fresh data
|
||||
source <(sudo /home/admin/config.scripts/blitz.statusscan.sh)
|
||||
|
||||
# display blockchain sync
|
||||
height=6
|
||||
width=45
|
||||
actionString="Please wait - this can take some time"
|
||||
|
||||
# formatting BLOCKCHAIN SYNC PROGRESS
|
||||
if [ "${syncProgress}" == "" ]; then
|
||||
if [ ${startcountBlockchain} -lt 2 ]; then
|
||||
syncProgress="waiting"
|
||||
else
|
||||
syncProgress="${startcountBlockchain} restarts"
|
||||
fi
|
||||
elif [ ${#syncProgress} -lt 6 ]; then
|
||||
syncProgress=" ${syncProgress} % ${peers} peers"
|
||||
else
|
||||
syncProgress="${syncProgress} % ${peers} peers"
|
||||
fi
|
||||
|
||||
# formatting LIGHTNING SCAN PROGRESS
|
||||
if [ "${scanProgress}" == "" ]; then
|
||||
# in case of LND RPC is not ready yet
|
||||
if [ ${scanTimestamp} -eq -2 ]; then
|
||||
scanProgress="prepare sync"
|
||||
# in case LND restarting >2
|
||||
elif [ ${startcountLightning} -gt 2 ]; then
|
||||
scanProgress="${startcountLightning} restarts"
|
||||
# unkown cases
|
||||
else
|
||||
scanProgress="waiting"
|
||||
fi
|
||||
elif [ ${#scanProgress} -lt 6 ]; then
|
||||
scanProgress=" ${scanProgress} %"
|
||||
else
|
||||
scanProgress="${scanProgress} %"
|
||||
fi
|
||||
|
||||
# setting info string
|
||||
infoStr=" Blockchain Progress : ${syncProgress}\n Lightning Progress : ${scanProgress}\n ${actionString}"
|
||||
|
||||
# set admin string
|
||||
if [ ${lcd} -eq 1 ]; then
|
||||
adminStr="ssh admin@${localip} ->Password A"
|
||||
else
|
||||
adminStr="Use CTRL+c to EXIT to Terminal"
|
||||
fi
|
||||
|
||||
# display info to user
|
||||
dialog --title " Node is Syncing " --backtitle "RaspiBlitz ${codeVersion} ${hostname} / ${network} / ${chain} / ${tempCelsius}°C" --infobox "${infoStr}\n ${adminStr}" ${height} ${width}
|
||||
|
||||
# determine to loop or not
|
||||
loop=0
|
||||
if [ ${loopUntilSynced} -eq 1 ] && [ "${syncedToChain}" == "0" ]; then
|
||||
# loop until synced to chain
|
||||
loop=1
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user