mirror of
https://github.com/mynodebtc/mynode.git
synced 2025-01-11 11:29:27 +00:00
Add service to fix invalid blocks
This commit is contained in:
parent
38cff419c5
commit
9b476d8f5f
|
@ -0,0 +1,23 @@
|
|||
# myNode invalid block service
|
||||
# /etc/systemd/system/invalid_block_check.service
|
||||
|
||||
[Unit]
|
||||
Description=myNode Bitcoin Invalid Block Check
|
||||
After=network.target mynode.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
KillMode=process
|
||||
ExecStart=/usr/bin/mynode_invalid_block_check.sh
|
||||
User=root
|
||||
Group=root
|
||||
TimeoutSec=300
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
Nice=5
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=bitcoind
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
21
rootfs/standard/usr/bin/mynode_invalid_block_check.sh
Executable file
21
rootfs/standard/usr/bin/mynode_invalid_block_check.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
sleep 5m
|
||||
|
||||
while [ 1 ]; do
|
||||
if [ -f /mnt/hdd/mynode/bitcoin/debug.log ]; then
|
||||
log=$(tail -n 10 /mnt/hdd/mynode/bitcoin/debug.log | grep "ERROR: AcceptBlockHeader")
|
||||
if [ $? == 0 ]; then
|
||||
block=$(tail -n 10 /mnt/hdd/mynode/bitcoin/debug.log | grep "ERROR: AcceptBlockHeader" | tail -n 1 | egrep -o "block [0-9a-f]+" | awk '{print $2}')
|
||||
echo "INVALID BLOCK FOUND: $block"
|
||||
echo "Fixing..."
|
||||
bitcoin-cli -rpccookiefile=/mnt/hdd/mynode/bitcoin/.cookie invalidateblock $block
|
||||
bitcoin-cli -rpccookiefile=/mnt/hdd/mynode/bitcoin/.cookie reconsiderblock $block
|
||||
echo "Done fixing block $block"
|
||||
sleep 10m
|
||||
fi
|
||||
fi
|
||||
sleep 5m
|
||||
done
|
|
@ -134,6 +134,7 @@ fi
|
|||
|
||||
# Enable any new/required services
|
||||
systemctl enable firewall
|
||||
systemctl enable invalid_block_check
|
||||
|
||||
# Disable any old services
|
||||
sudo systemctl disable hitch
|
||||
|
|
|
@ -338,6 +338,7 @@ systemctl enable tls_proxy
|
|||
systemctl enable rtl
|
||||
systemctl enable lnd_admin
|
||||
systemctl enable tor
|
||||
systemctl enable invalid_block_check
|
||||
|
||||
|
||||
# Delete junk
|
||||
|
|
Loading…
Reference in New Issue
Block a user