specter: add blockfilterindex (#1636)

This commit is contained in:
openoms 2020-10-11 19:47:05 +01:00 committed by rootzoll
parent eb18f4a3e8
commit 686cc68825

View file

@ -88,6 +88,14 @@ if ! grep -Eq "^specter=" /mnt/hdd/raspiblitz.conf; then
echo "specter=off" >> /mnt/hdd/raspiblitz.conf
fi
# blockfilterindex
# add blockfilterindex with default value (0) to bitcoin.conf if missing
if ! grep -Eq "^blockfilterindex=.*" /mnt/hdd/${network}/${network}.conf; then
echo "blockfilterindex=0" | sudo tee -a /mnt/hdd/${network}/${network}.conf >/dev/null
fi
# set variable ${blockfilterindex}
source <(grep -E "^blockfilterindex=.*" /mnt/hdd/${network}/${network}.conf)
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# --> INSTALL Cryptoadvance Specter ***"
@ -254,6 +262,19 @@ EOF
# port 25441 is HTTPS with self-signed cert - specte only makes sense to be served over HTTPS
/home/admin/config.scripts/internet.hiddenservice.sh cryptoadvance-specter 443 25441
fi
# blockfilterindex on
# check txindex (parsed and sourced from bitcoin network config above)
if [ ${blockfilterindex} == 0 ]; then
sudo sed -i "s/^blockfilterindex=.*/blockfilterindex=1/g" /mnt/hdd/${network}/${network}.conf
echo "switching blockfilterindex=1 and restarting ${network}d"
sudo systemctl restart ${network}d
echo "The indexing takes ~10h on an RPi4 with SSD"
echo "check with: sudo cat /mnt/hdd/bitcoin/debug.log | grep filter"
else
echo "blockfilterindex is already active"
fi
exit 0
fi
@ -286,9 +307,22 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
bitcoin-cli unloadwallet specter/$name
done
sudo rm -rf /home/bitcoin/.bitcoin/specter
echo "# --> Removing /home/bitcoin/.specter"
sudo rm -rf /home/bitcoin/.specter
echo "# --> Removing blockfilterindex"
echo "# changing config ..."
sudo systemctl stop ${network}d
sudo sed -i "s/^blockfilterindex=.*/blockfilterindex=0/g" /mnt/hdd/${network}/${network}.conf
echo "# deleting blockfilterindex ..."
sudo rm -r /mnt/hdd/${network}/indexes/blockfilter
echo "# restarting bitcoind ..."
sudo systemctl restart ${network}d
else
echo "# --> Switch off the blockfilterindex"
sudo sed -i "s/^blockfilterindex=.*/blockfilterindex=0/g" /mnt/hdd/${network}/${network}.conf
echo "# restarting bitcoind ..."
sudo systemctl restart ${network}d
fi
echo "# --> OK Cryptoadvance Specter removed."