Skip to content

Instantly share code, notes, and snippets.

@buzzkillb
Created June 27, 2020 19:17
Show Gist options
  • Select an option

  • Save buzzkillb/150238e6bb263802d5ae0b06d442cf2a to your computer and use it in GitHub Desktop.

Select an option

Save buzzkillb/150238e6bb263802d5ae0b06d442cf2a to your computer and use it in GitHub Desktop.
#!/bin/bash
#Revolver - Cycle through single daemon to ping the network as fast as possible
#genkeylist.txt is a copy of your masternode.conf or fortunastake.conf in same directory this script runs from
# daemon location
denariusdaemon=/usr/local/bin/denariusd
# debug.log location
debuglog=~/.denarius/debug.log
# denarius.conf location
denariusconf=~/.denarius/denarius.conf
while true; do
FULL_LINE=$(awk 'NR==1' genkeylist.txt)
ALIAS=$(awk '{if(NR==1) print $1}' genkeylist.txt)
IP_ADDRESS=$(awk '{if(NR==1) print $2}' genkeylist.txt)
GENKEY=$(awk '{if(NR==1) print $3}' genkeylist.txt)
echo "Alias:" "${ALIAS}" "IP Address:" "${IP_ADDRESS}" "GENKEY:" "${GENKEY}"
# insert GENKEY into denarius.conf
sed -i "s:^fortunastakeprivkey=.*$:fortunastakeprivkey="${GENKEY}":g" "${denariusconf}"
# start daemon
$denariusdaemon -staking=0 -maxconnections=8
sleep 2
#remove first line to move to bottom
sed -i '1d' genkeylist.txt
#put FULL_LINE at bottom of genkeylist.txt
echo "${FULL_LINE}" >> genkeylist.txt
#watch debug.log for dseep, adjust timeout for how long it takes to start wallet and sync to Ping
echo "waiting for dseep"
timeout 140s tail -f $debuglog | egrep -m 1 "SendForTunaElectionEntryPing vin = CTxIn"
sleep 4
#stop daemon
$denariusdaemon stop
#adjust sleep to how long daemon takes to fully exit
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment