From 66ca40ee0d82aa7e9c33fe0f02bd76b5cfe0af8f Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 28 Apr 2019 22:09:19 +0200 Subject: [PATCH] move channel.backup activation after sync --- home.admin/00raspiblitz.sh | 49 +++++++++++++++++++++++++++++++++++++- home.admin/70initLND.sh | 48 +------------------------------------ 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/home.admin/00raspiblitz.sh b/home.admin/00raspiblitz.sh index 1b110b1..96948ae 100755 --- a/home.admin/00raspiblitz.sh +++ b/home.admin/00raspiblitz.sh @@ -322,8 +322,55 @@ else exit 0 fi - # when all is setup - forward to main menu + # wait all is synced and ready waitUntilChainNetworkIsReady + + # check if there is a channel.backup to activate + gotSCB=$(ls /home/admin/channel.backup 2>/dev/null | grep -c 'channel.backup') + if [ ${gotSCB} -eq 1 ]; then + + echo "*** channel.backup Recovery ***" + lncli restorechanbackup --multi_file=/home/admin/channel.backup 2>/home/admin/.error.tmp + error=`cat /home/admin/.error.tmp` + rm /home/admin/.error.tmp 2>/dev/null + + if [ ${#error} -gt 0 ]; then + + # output error message + echo "" + echo "!!! FAIL !!! SOMETHING WENT WRONG:" + echo "${error}" + + # check if its possible to give background info on the error + notMachtingSeed=$(echo $error | grep -c 'unable to unpack chan backup') + if [ ${notMachtingSeed} -gt 0 ]; then + echo "--> ERROR BACKGROUND:" + echo "The WORD SEED is not matching the channel.backup file." + echo "Either there was an error in the word seed list or" + echo "or the channel.backup file is from another RaspiBlitz." + echo + fi + + # basic info on error + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo + echo "You can try after full setup to restore channel.backup file again with:" + echo "lncli restorechanbackup --multi_file=/home/admin/channel.backup" + echo + echo "Press ENTER to continue for now ..." + read key + else + mv /home/admin/channel.backup /home/admin/channel.backup.done + dialog --title " OK channel.backup IMPORT " --msgbox " +LND accepted the channel.backup file you uploaded. +It will now take around a hour until you can see, +if LND was able to recover funds from your channels. + " 9 56 + fi + + fi + + #forward to main menu /home/admin/00mainMenu.sh exit 0 diff --git a/home.admin/70initLND.sh b/home.admin/70initLND.sh index ba0541c..601f6a4 100755 --- a/home.admin/70initLND.sh +++ b/home.admin/70initLND.sh @@ -337,7 +337,7 @@ or having a complete LND rescue-backup from your old node. exit 1 else clear - echo "FILE UPLOADED --> will get checked/activated after wallet restore from seed" + echo "FILE UPLOADED --> will get checked/activated after blockchain/lightning is synced" fi fi @@ -456,52 +456,6 @@ else fi echo "" -###### USE CHANNEL.BACKUP FILE IF AVAILABLE -echo "*** channel.backup Recovery ***" -gotSCB=$(ls /home/admin/channel.backup 2>/dev/null | grep -c 'channel.backup') -if [ ${gotSCB} -eq 1 ]; then - - lncli restorechanbackup --multi_file=/home/admin/channel.backup 2>/home/admin/.error.tmp - error=`cat /home/admin/.error.tmp` - rm /home/admin/.error.tmp 2>/dev/null - - if [ ${#error} -gt 0 ]; then - - # output error message - echo "" - echo "!!! FAIL !!! SOMETHING WENT WRONG:" - echo "${error}" - - # check if its possible to give background info on the error - notMachtingSeed=$(echo $error | grep -c 'unable to unpack chan backup') - if [ ${notMachtingSeed} -gt 0 ]; then - echo "--> ERROR BACKGROUND:" - echo "The WORD SEED is not matching the channel.backup file." - echo "Either there was an error in the word seed list or" - echo "or the channel.backup file is from another RaspiBlitz." - echo - fi - - # basic info on error - echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - echo - echo "You can try after full setup to restore channel.backup file again with:" - echo "lncli restorechanbackup --multi_file=/home/admin/channel.backup" - echo - echo "Press ENTER to continue for now ..." - read key - else - dialog --title " OK channel.backup IMPORT " --msgbox " -LND accepted the channel.backup file you uploaded. -After LND is synced to the blockchain it will try -to close your old channels to recover the funds. - " 9 54 - fi - -else - echo "NO /home/admin/channel.backup file - skipping SCB" -fi - # set SetupState (scan is done - so its 80%) sudo sed -i "s/^setupStep=.*/setupStep=80/g" /home/admin/raspiblitz.info