mirror of
https://github.com/Retropex/raspiblitz.git
synced 2025-05-13 03:30:49 +02:00
fix CLN wallet reset (#3296)
* cln: unify and improve the resetWallet function previously the old config and channel database could have been left behind when using SEEDRESTORE and FILERESTORE * prompt to save the wallet password for backup
This commit is contained in:
parent
7074455380
commit
eaacab9679
@ -29,6 +29,13 @@ If left empty will start to rescan from the block 700000 (-700000).
|
|||||||
sudo systemctl restart ${netprefix}lightningd
|
sudo systemctl restart ${netprefix}lightningd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetWallet() {
|
||||||
|
echo "# Delete ${CLCONF}"
|
||||||
|
sudo rm -f ${CLCONF}
|
||||||
|
echo "# Delete and recreate /home/bitcoin/.lightning/${CLNETWORK}"
|
||||||
|
sudo rm -rf /home/bitcoin/.lightning/${CLNETWORK}
|
||||||
|
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${CLNETWORK}
|
||||||
|
}
|
||||||
|
|
||||||
# BASIC MENU INFO
|
# BASIC MENU INFO
|
||||||
WIDTH=64
|
WIDTH=64
|
||||||
@ -93,7 +100,9 @@ case $CHOICE in
|
|||||||
if [ "${cl}" == "on" ] || [ "${cl}" == "1" ] && [ "${clEncryptedHSM}" != "on" ]; then
|
if [ "${cl}" == "on" ] || [ "${cl}" == "1" ] && [ "${clEncryptedHSM}" != "on" ]; then
|
||||||
dialog \
|
dialog \
|
||||||
--title "Encrypt the Core Lightning wallet" \
|
--title "Encrypt the Core Lightning wallet" \
|
||||||
--msgbox "\nWill proceed to encrypt and lock the Core Lightning wallet to prevent it from starting automatically after the backup" 9 55
|
--msgbox "
|
||||||
|
Will proceed to encrypt and lock the Core Lightning wallet to prevent it from starting automatically after the backup.
|
||||||
|
Save this password as it will be needed to restore the backup (same as the Password C for CLN)." 10 55
|
||||||
sudo /home/admin/config.scripts/cl.hsmtool.sh encrypt mainnet
|
sudo /home/admin/config.scripts/cl.hsmtool.sh encrypt mainnet
|
||||||
fi
|
fi
|
||||||
if [ "${clAutoUnlock}" = "on" ]; then
|
if [ "${clAutoUnlock}" = "on" ]; then
|
||||||
@ -122,15 +131,12 @@ case $CHOICE in
|
|||||||
echo
|
echo
|
||||||
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
||||||
echo
|
echo
|
||||||
echo "The next step will overwrite the old C-lighthning $CHAIN wallet"
|
echo "The next step will overwrite the old Core Lightning $CHAIN wallet"
|
||||||
echo "Press ENTER to continue or CTRL+C to abort"
|
echo "Press ENTER to continue or CTRL+C to abort"
|
||||||
read key
|
read key
|
||||||
# reset
|
|
||||||
echo "# Delete ${CLCONF}"
|
resetWallet
|
||||||
sudo rm -f ${CLCONF}
|
|
||||||
echo "# Delete and recreate /home/bitcoin/.lightning/${CLNETWORK}"
|
|
||||||
sudo rm -rf /home/bitcoin/.lightning/${CLNETWORK}
|
|
||||||
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${CLNETWORK}
|
|
||||||
# make sure the new hsm_secret is treated as unencrypted and clear autounlock
|
# make sure the new hsm_secret is treated as unencrypted and clear autounlock
|
||||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clEncryptedHSM "off"
|
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clEncryptedHSM "off"
|
||||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clAutoUnlock "off"
|
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clAutoUnlock "off"
|
||||||
@ -161,12 +167,12 @@ case $CHOICE in
|
|||||||
echo
|
echo
|
||||||
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
||||||
echo
|
echo
|
||||||
echo "The next step will overwrite the old C-lighthning $CHAIN wallet"
|
echo "The next step will overwrite the old Core Lightning $CHAIN wallet"
|
||||||
echo "Press ENTER to continue or CTRL+C to abort"
|
echo "Press ENTER to continue or CTRL+C to abort"
|
||||||
read key
|
read key
|
||||||
# reset
|
|
||||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret
|
resetWallet
|
||||||
sudo rm -rf /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
|
||||||
# import file
|
# import file
|
||||||
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
|
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
|
||||||
clear
|
clear
|
||||||
@ -186,13 +192,12 @@ case $CHOICE in
|
|||||||
echo
|
echo
|
||||||
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
||||||
echo
|
echo
|
||||||
echo "The next step will overwrite the old C-lighthning $CHAIN wallet"
|
echo "The next step will overwrite the old Core Lightning $CHAIN wallet"
|
||||||
echo "Press ENTER to continue or CTRL+C to abort"
|
echo "Press ENTER to continue or CTRL+C to abort"
|
||||||
read key
|
read key
|
||||||
# reset
|
|
||||||
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret
|
resetWallet
|
||||||
sudo rm -f /home/bitcoin/.lightning/${CLNETWORK}/config
|
|
||||||
sudo rm -rf /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
|
||||||
# import seed
|
# import seed
|
||||||
_temp="/var/cache/raspiblitz/.temp.tmp"
|
_temp="/var/cache/raspiblitz/.temp.tmp"
|
||||||
/home/admin/config.scripts/cl.backup.sh seed-import-gui $_temp
|
/home/admin/config.scripts/cl.backup.sh seed-import-gui $_temp
|
||||||
|
Loading…
Reference in New Issue
Block a user