diff --git a/rootfs/standard/usr/bin/mynode_background.sh b/rootfs/standard/usr/bin/mynode_background.sh index 3fc925eb..926ed19a 100755 --- a/rootfs/standard/usr/bin/mynode_background.sh +++ b/rootfs/standard/usr/bin/mynode_background.sh @@ -9,6 +9,7 @@ source /usr/share/mynode/mynode_app_versions.sh # NOTE: Background services will run before mynode service completes, so a drive MAY NOT be attached COUNTER=0 +BITCOIN_SYNCED=0 while true; do @@ -31,6 +32,16 @@ while true; do fi fi + # Custom startup hook - post-bitcoin-synced + if [ -f /usr/local/bin/mynode_hook_post_bitcoin_synced.sh ]; then + if [ $BITCOIN_SYNCED == 0 ] && [ -f $BITCOIN_SYNCED_FILE ]; then + /bin/bash /usr/local/bin/mynode_hook_post_bitcoin_synced.sh || true + BITCOIN_SYNCED=1 + else + BITCOIN_SYNCED=0 + fi + fi + # Increment counter and sleep 1 min COUNTER=$((COUNTER+1)) diff --git a/rootfs/standard/usr/bin/mynode_startup.sh b/rootfs/standard/usr/bin/mynode_startup.sh index a001eb29..742bbda5 100755 --- a/rootfs/standard/usr/bin/mynode_startup.sh +++ b/rootfs/standard/usr/bin/mynode_startup.sh @@ -136,6 +136,10 @@ fi rm -f /tmp/repairing_drive set -e +# Custom startup hook - pre-startup +if [ -f /usr/local/bin/mynode_hook_pre_startup.sh ]; then + /bin/bash /usr/local/bin/mynode_hook_pre_startup.sh || true +fi # Mount HDD (normal boot, format if necessary) while [ ! -f /mnt/hdd/.mynode ] @@ -790,9 +794,10 @@ if [ -f /usr/share/joininbox/menu.update.sh ] && [ -f /home/joinmarket/menu.upda fi chown bitcoin:bitcoin /mnt/hdd/mynode/settings/.lndpw || true -# Check for new versions -torify wget $LATEST_VERSION_URL --timeout=30 -O /usr/share/mynode/latest_version || true -torify wget $LATEST_BETA_VERSION_URL --timeout=30 -O /usr/share/mynode/latest_beta_version || true +# Custom startup hook - post-startup +if [ -f /usr/local/bin/mynode_hook_post_startup.sh ]; then + /bin/bash /usr/local/bin/mynode_hook_post_startup.sh || true +fi # Update current state if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then diff --git a/rootfs/standard/var/www/mynode/thread_functions.py b/rootfs/standard/var/www/mynode/thread_functions.py index 65fdd0aa..ceaa6a13 100644 --- a/rootfs/standard/var/www/mynode/thread_functions.py +++ b/rootfs/standard/var/www/mynode/thread_functions.py @@ -110,7 +110,7 @@ def update_bitcoin_main_info_thread(): bitcoin_block_height = get_bitcoin_block_height() mynode_block_height = get_mynode_block_height() remaining = bitcoin_block_height - mynode_block_height - if remaining == 0 and bitcoin_block_height > 680000: + if remaining == 0 and bitcoin_block_height > 710000: synced = True if not os.path.isfile(BITCOIN_SYNCED_FILE): open(BITCOIN_SYNCED_FILE, 'a').close() # touch file