diff --git a/rootfs/raspi4/usr/share/mynode/bitcoin.conf b/rootfs/raspi4/usr/share/mynode/bitcoin.conf index c63f21e9..9cf760fc 100644 --- a/rootfs/raspi4/usr/share/mynode/bitcoin.conf +++ b/rootfs/raspi4/usr/share/mynode/bitcoin.conf @@ -20,7 +20,7 @@ zmqpubrawblock=tcp://127.0.0.1:28332 zmqpubrawtx=tcp://127.0.0.1:28333 # myNode Optimizations -dbcache=500 +dbcache=600 maxorphantx=10 maxmempool=200 maxconnections=40 diff --git a/rootfs/standard/etc/systemd/system/bitcoind.service b/rootfs/standard/etc/systemd/system/bitcoind.service index 6f1cbda6..a9e578ff 100644 --- a/rootfs/standard/etc/systemd/system/bitcoind.service +++ b/rootfs/standard/etc/systemd/system/bitcoind.service @@ -6,6 +6,7 @@ Description=Bitcoin daemon After=network.target mynode.service [Service] +ExecStartPre=/usr/bin/wait_on_uploader.sh ExecStartPre=/bin/sh -c 'cat /mnt/hdd/mynode/quicksync/.quicksync_complete' EnvironmentFile=/mnt/hdd/mynode/bitcoin/env ExecStart=/usr/local/bin/bitcoind -daemon $BTCARGS -deprecatedrpc=accounts -par=-1 -conf=/home/bitcoin/.bitcoin/bitcoin.conf -printtoconsole -pid=/home/bitcoin/.bitcoin/bitcoind.pid diff --git a/rootfs/standard/usr/bin/mynode_bandwidth.sh b/rootfs/standard/usr/bin/mynode_bandwidth.sh index 2bff7d00..44e2720d 100755 --- a/rootfs/standard/usr/bin/mynode_bandwidth.sh +++ b/rootfs/standard/usr/bin/mynode_bandwidth.sh @@ -8,6 +8,13 @@ source /usr/share/mynode/mynode_config.sh # Let transmission startup sleep 60s +# If marked as uploader, dont slow down +while [ -f $UPLOADER_FILE ]; do + echo "Marked as uploader, unlimited upload" + transmission-remote -U + sleep 1h +done + # Upload slowly while downloading transmission-remote -u 0 @@ -25,7 +32,10 @@ done echo "QuickSync Complete! Enabling Uploading." while true; do - if [ ! -f "/mnt/hdd/mynode/quicksync/.quicksync_complete" ]; then + if [ -f $UPLOADER_FILE ]; then + echo "Marked as uploader, unlimited upload" + transmission-remote -U + elif [ ! -f "/mnt/hdd/mynode/quicksync/.quicksync_complete" ]; then echo "QuickSync not complete, stopping upload" transmission-remote -u 0 elif [ ! -f "/mnt/hdd/mynode/.mynode_bitcoind_synced" ]; then diff --git a/rootfs/standard/usr/bin/mynode_torrent_check.sh b/rootfs/standard/usr/bin/mynode_torrent_check.sh index d99abbec..6464f0be 100755 --- a/rootfs/standard/usr/bin/mynode_torrent_check.sh +++ b/rootfs/standard/usr/bin/mynode_torrent_check.sh @@ -6,16 +6,23 @@ echo "Waiting until QuickSync is complete..." while [ ! -f "$QUICKSYNC_COMPLETE_FILE" ]; do sleep 1m done -echo "Quicksync Complete! Waiting until Bitcoin Sync is complete..." -while [ ! -f "$BITCOIN_SYNCED_FILE" ]; do - sleep 1m -done -echo "Bitcoin Sync Complete! Checking if there is a new torrent available..." -sleep 1d +if [ ! -f $UPLOADER_FILE ]; then + echo "Quicksync Complete! Waiting until Bitcoin Sync is complete..." + while [ ! -f "$BITCOIN_SYNCED_FILE" ]; do + sleep 1m + done + echo "Bitcoin Sync Complete! Checking if there is a new torrent available..." + sleep 1d +fi while true; do # Wait a while... we don't want everyone starting on a new torrent at once - sleep 7d + if [ -f $UPLOADER_FILE ]; then + echo "Marked as uploader, checking for new torrent in 1 day..." + sleep 1d + else + sleep 10d + fi # Download current torrent rm -rf /tmp/blockchain_temp.torrent diff --git a/rootfs/standard/usr/bin/wait_on_uploader.sh b/rootfs/standard/usr/bin/wait_on_uploader.sh new file mode 100755 index 00000000..b2a10843 --- /dev/null +++ b/rootfs/standard/usr/bin/wait_on_uploader.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e +set -x + +source /usr/share/mynode/mynode_config.sh + +# Don't start bitcoind if we are marked as an uploader +echo "Checking if uploader..." +while [ -f $UPLOADER_FILE ]; do + echo "We are an uploader, sleeping for 15 minutes..." + /bin/sleep 15m +done + +exit 0 \ No newline at end of file diff --git a/rootfs/standard/usr/share/mynode/bitcoin.conf b/rootfs/standard/usr/share/mynode/bitcoin.conf index c63f21e9..9cf760fc 100644 --- a/rootfs/standard/usr/share/mynode/bitcoin.conf +++ b/rootfs/standard/usr/share/mynode/bitcoin.conf @@ -20,7 +20,7 @@ zmqpubrawblock=tcp://127.0.0.1:28332 zmqpubrawtx=tcp://127.0.0.1:28333 # myNode Optimizations -dbcache=500 +dbcache=600 maxorphantx=10 maxmempool=200 maxconnections=40 diff --git a/rootfs/standard/usr/share/mynode/mynode_config.sh b/rootfs/standard/usr/share/mynode/mynode_config.sh index 6b8e35d2..33507d8f 100644 --- a/rootfs/standard/usr/share/mynode/mynode_config.sh +++ b/rootfs/standard/usr/share/mynode/mynode_config.sh @@ -15,7 +15,8 @@ MYNODE_DIR=/mnt/hdd/mynode QUICKSYNC_DIR=/mnt/hdd/mynode/quicksync QUICKSYNC_CONFIG_DIR=/mnt/hdd/mynode/.config/transmission QUICKSYNC_TORRENT_URL="https://mynodebtc.com/device/blockchain.tar.gz.torrent" -QUICKSYNC_BANDWIDTH_FILE="/mnt/hdd/mynode/settings/.bandwidth" +QUICKSYNC_BANDWIDTH_FILE="/mnt/hdd/mynode/settings/bandwidth" +UPLOADER_FILE="/mnt/hdd/mynode/settings/uploader" LND_BACKUP_FOLDER="/home/bitcoin/lnd_backup/" LND_TLS_CERT_FILE="/mnt/hdd/mynode/lnd/tls.cert" LND_WALLET_FILE="/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/wallet.db" diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index 7fa09568..692ca4c6 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -44,6 +44,10 @@ def get_device_type(): return CONFIG["device_type"] +def is_uploader(): + return os.path.isfile("/mnt/hdd/mynode/settings/uploader") + + def set_skipped_product_key(): os.system("touch /home/bitcoin/.mynode/.product_key_skipped") os.system("touch /mnt/hdd/mynode/settings/.product_key_skipped") diff --git a/rootfs/standard/var/www/mynode/mynode.py b/rootfs/standard/var/www/mynode/mynode.py index a198f74e..1653165b 100644 --- a/rootfs/standard/var/www/mynode/mynode.py +++ b/rootfs/standard/var/www/mynode/mynode.py @@ -88,6 +88,17 @@ def index(): pk_skipped = skipped_product_key() pk_error = not is_valid_product_key() + # Show uploader page if we are marked as an uploader + if is_uploader(): + status = subprocess.check_output(["mynode-get-quicksync-status"]) + status = Markup("
"+status+"