From 89b099ca2f8164fa34969687e8912952db631d17 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Sat, 16 Dec 2023 23:41:02 -0600 Subject: [PATCH] Add dynamic assumevalid setting during first sync --- .../usr/bin/mynode_gen_bitcoin_config.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/rootfs/standard/usr/bin/mynode_gen_bitcoin_config.sh b/rootfs/standard/usr/bin/mynode_gen_bitcoin_config.sh index ea3b1d17..9606b7e6 100755 --- a/rootfs/standard/usr/bin/mynode_gen_bitcoin_config.sh +++ b/rootfs/standard/usr/bin/mynode_gen_bitcoin_config.sh @@ -105,6 +105,27 @@ else cat /usr/share/mynode/bitcoin_bip158.conf >> /mnt/hdd/mynode/bitcoin/bitcoin.conf fi + # Add assumevalid setting + if [ ! -f /mnt/hdd/mynode/.mynode_bitcoin_synced_at_least_once ]; then + rm -f /tmp/bitcoin_assumevalid + torify wget https://mynodebtc.com/device_api/get_assumevalid.php --timeout 5 --tries 2 -q -O /tmp/bitcoin_assumevalid || \ + wget https://mynodebtc.com/device_api/get_assumevalid.php --timeout 5 --tries 2 -q -O /tmp/bitcoin_assumevalid || \ + true + if [ -f /tmp/bitcoin_assumevalid ]; then + assumevalid_hash=$(cat /tmp/bitcoin_assumevalid) + echo "" >> /mnt/hdd/mynode/bitcoin/bitcoin.conf + echo "" >> /mnt/hdd/mynode/bitcoin/bitcoin.conf + echo "# Dynamic Assume Valid Setting for Faster Initial Sync" >> /mnt/hdd/mynode/bitcoin/bitcoin.conf + if [ "${#assumevalid_hash}" = "64" ]; then + echo "assumevalid=$assumevalid_hash" >> /mnt/hdd/mynode/bitcoin/bitcoin.conf + else + echo "# BAD HASH" >> /mnt/hdd/mynode/bitcoin/bitcoin.conf + fi + echo "" >> /mnt/hdd/mynode/bitcoin/bitcoin.conf + echo "" >> /mnt/hdd/mynode/bitcoin/bitcoin.conf + fi + fi + # Update Debug Log Settings if [ -f /home/bitcoin/.mynode/keep_bitcoin_debug_log ] || [ -f /mnt/hdd/mynode/settings/keep_bitcoin_debug_log ]; then sed -i "s/shrinkdebugfile=.*/shrinkdebugfile=0/g" /mnt/hdd/mynode/bitcoin/bitcoin.conf