joinmarket: check for the bitcoin core wallet last (#3752)

This commit is contained in:
openoms 2023-04-19 10:53:08 +01:00 committed by GitHub
parent 158c077dee
commit 4217baa714
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,25 +159,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo /home/admin/config.scripts/bonus.joinmarket.sh install
fi
# make sure the Bitcoin Core wallet is on
/home/admin/config.scripts/network.wallet.sh on
if [ $(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf listwallets | grep -c wallet.dat) -eq 0 ]; then
echo "# Create a non-descriptor wallet.dat"
/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -named createwallet wallet_name=wallet.dat descriptors=false
else
isDescriptor=$(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -rpcwallet=wallet.dat getwalletinfo | grep -c '"descriptors": true,')
if [ "$isDescriptor" -gt 0 ]; then
# unload
bitcoin-cli unloadwallet wallet.dat
echo "# Move the wallet.dat with descriptors to /mnt/hdd/bitcoin/descriptors"
sudo mv /mnt/hdd/bitcoin/wallet.dat /mnt/hdd/bitcoin/descriptors
echo "# Create a non-descriptor wallet.dat"
bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -named createwallet wallet_name=wallet.dat descriptors=false
else
echo "# The non-descriptor wallet.dat is loaded in bitcoind."
fi
fi
# store JoinMarket data on HDD
mkdir /mnt/hdd/app-data/.joinmarket 2>/dev/null
@ -212,6 +193,25 @@ if [ -z \"\$TMUX\" ]; then
fi
" | sudo -u joinmarket tee -a /home/joinmarket/.bashrc
# make sure the Bitcoin Core wallet is on
/home/admin/config.scripts/network.wallet.sh on
if [ $(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf listwallets | grep -c wallet.dat) -eq 0 ]; then
echo "# Create a non-descriptor wallet.dat"
/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -named createwallet wallet_name=wallet.dat descriptors=false
else
isDescriptor=$(/usr/local/bin/bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -rpcwallet=wallet.dat getwalletinfo | grep -c '"descriptors": true,')
if [ "$isDescriptor" -gt 0 ]; then
# unload
bitcoin-cli unloadwallet wallet.dat
echo "# Move the wallet.dat with descriptors to /mnt/hdd/bitcoin/descriptors"
sudo mv /mnt/hdd/bitcoin/wallet.dat /mnt/hdd/bitcoin/descriptors
echo "# Create a non-descriptor wallet.dat"
bitcoin-cli -conf=/mnt/hdd/bitcoin/bitcoin.conf -named createwallet wallet_name=wallet.dat descriptors=false
else
echo "# The non-descriptor wallet.dat is loaded in bitcoind."
fi
fi
# configure joinmarket (includes a check if it is installed)
if sudo -u joinmarket /home/joinmarket/start.joininbox.sh; then
echo "# Start to use by logging in to the 'joinmarket' user with:"