workaround for lnd rescan bug
This commit is contained in:
parent
ce94b316fb
commit
3b8ec65c67
6 changed files with 92 additions and 2 deletions
|
|
@ -12,7 +12,7 @@ get_log_info() {
|
|||
LOG_DIR="$USER_HOME/lightning_pub/logs"
|
||||
DATA_DIR="$USER_HOME/lightning_pub/"
|
||||
START_TIME=$(date +%s)
|
||||
MAX_WAIT_TIME=120 # Maximum wait time in seconds
|
||||
MAX_WAIT_TIME=360 # Maximum wait time in seconds (6 minutes)
|
||||
WAIT_INTERVAL=5 # Time to wait between checks in seconds
|
||||
|
||||
log "Checking wallet status... This may take a moment."
|
||||
|
|
@ -50,7 +50,24 @@ get_log_info() {
|
|||
START_TIME=$(date +%s)
|
||||
while [ $(($(date +%s) - START_TIME)) -lt $MAX_WAIT_TIME ]; do
|
||||
latest_entry=$(grep -E "unlocker >> (the wallet is already unlocked|created wallet with pub:|unlocked wallet with pub)" "$latest_unlocker_log" | tail -n 1)
|
||||
|
||||
# Show dynamic header sync progress if available from unlocker logs
|
||||
progress_line=$(grep -E "LND header sync [0-9]+% \(height=" "$latest_unlocker_log" | tail -n 1)
|
||||
if [ -n "$progress_line" ]; then
|
||||
percent=$(echo "$progress_line" | sed -E 's/.*LND header sync ([0-9]+)%.*/\1/')
|
||||
if [[ "$percent" =~ ^[0-9]+$ ]]; then
|
||||
bar_len=30
|
||||
filled=$((percent*bar_len/100))
|
||||
if [ $filled -gt $bar_len ]; then filled=$bar_len; fi
|
||||
empty=$((bar_len-filled))
|
||||
filled_bar=$(printf '%*s' "$filled" | tr ' ' '#')
|
||||
empty_bar=$(printf '%*s' "$empty" | tr ' ' ' ')
|
||||
echo -ne "Header sync: [${filled_bar}${empty_bar}] ${percent}%\r"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$latest_entry" ]; then
|
||||
# End the progress line cleanly
|
||||
echo ""
|
||||
break
|
||||
fi
|
||||
sleep $WAIT_INTERVAL
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ else
|
|||
# Only start services if it was a fresh install or an upgrade.
|
||||
if [ "$pub_upgrade_status" -eq 0 ] || [ "$pub_upgrade_status" -eq 100 ]; then
|
||||
log "Starting services..."
|
||||
log "Note: LND may take several minutes to sync block headers depending on network conditions."
|
||||
touch /tmp/pub_install_timestamp
|
||||
start_services $lnd_status $pub_upgrade_status || log_error "Failed to start services" 1
|
||||
get_log_info || log_error "Failed to get log info" 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue