qwizzie
Well-known member
Dashmate users that want to stop their Dashmate in order to update their Core version, or update their Dashmate version or do server Maintenance or want to do a server reboot, first need to check if their Evonode/Masternode is currently not involved in any LLMQ quorum, that give high PoSe Penalty scores when interrupted. To avoid these high PoSe Penalty scores or PoSe bans (interrupting two llmq quorums = Instant PoSe ban), the following shell script can be created and used to fetch this directly from Dashmate core.log
From Windows :
Step 1 : Create a new text file
Step 2 : Add following text (last edited 15th of January 2024)
#!/bin/bash
echo
# Function to extract the highest block height
get_highest_value() {
local highest_value=$(tac ~/.dashmate/logs/mainnet/core.log | grep -o 'height=[0-9]*' | head -n 1 | cut -d '=' -f2)
echo "$highest_value"
}
# Function to get the height value for a specific quorum type
get_height_value() {
local quorum_type=$1
local result=$(tac ~/.dashmate/logs/mainnet/core.log | grep "quorum initialization OK for $quorum_type" | head -n 1)
if [[ -z "$result" ]]; then
echo -e "\e[31mError: Quorum initialization not found for $quorum_type\e[0m"
exit 1
fi
local height_value=$(echo "$result" | grep -o 'height\[[0-9]*\]' | head -n 1 | cut -d '[' -f2 | cut -d ']' -f1)
if [[ -z "$height_value" ]]; then
echo -e "\e[31mError: Failed to extract height value for $quorum_type\e[0m"
exit 1
fi
echo "$height_value"
}
# Main script
highest_value=$(get_highest_value)
echo -e "\e[36mCurrent Block Height : \e[36m$highest_value\e[0m"
sleep 1
echo
# Check llmq_60_75
result=$(tac ~/.dashmate/logs/mainnet/core.log | grep "quorum initialization OK for llmq_60_75" | head -n 1)
if [[ "$result" == *"llmq_60_75 qi[31]"* ]]; then
echo -e "\e[36mllmq quorum_60_75 reached final stage \e[32m[31]\e[36m\e[0m"
echo -e "\e[33mplease take quorum restarts into account\e[0m"
value2=$(get_height_value "llmq_60_75")
result2=$(echo "$value2+288-$highest_value" | bc 2>/dev/null)
if [[ "$result2" == "" ]]; then
echo -e "\e[31mError: Failed to calculate llmq_60_75 blocks to go before quorum restart\e[0m"
else
echo
echo -e "\e[36mllmq_60_75 blocks to go before quorum restart (interval 288) : $result2\e[0m"
fi
else
echo -e "\e[31m***** $result *****\e[0m"
echo -e "\e[31m***** llmq_60_75 is still in progress (not [31]), do not interrupt !! *****\e[0m"
echo
fi
sleep 1
# Check llmq_100_67
value3=$(get_height_value "llmq_100_67")
result3=$(echo "$value3+24-$highest_value" | bc 2>/dev/null)
if [[ "$result3" == "" ]]; then
echo -e "\e[31mError: Failed to calculate llmq_100_67 blocks to go before quorum restart\e[0m"
else
echo -e "\e[36mllmq_100_67 blocks to go before quorum restart (interval 24) : $result3\e[0m"
fi
# Check llmq_400_60
value4=$(get_height_value "llmq_400_60")
result4=$(echo "$value4+288-$highest_value" | bc 2>/dev/null)
if [[ "$result4" == "" ]]; then
echo -e "\e[31mError: Failed to calculate llmq_400_60 blocks to go before quorum restart\e[0m"
else
echo -e "\e[36mllmq_400_60 blocks to go before quorum restart (interval 288) : $result4\e[0m"
fi
echo
# Combined check at the end
if [[ "$result" == *"llmq_60_75 qi[31]"* && "$highest_value" != "$value2" && "$highest_value" != "$value3" && "$highest_value" != "$value4" ]]; then
echo -e "\e[32m***** All llmq quorums blockheights older than current blockheight & llmq_60_75 reached final stage [31] --> all quorums finished *****\e[0m"
else
echo -e "\e[31m***** Do not interrupt for now, 1 or more quorums not finished !! *****\e[0m"
fi
sleep 1
echo
Step 3 : Save as posecheck.txt
Step 4 : Rename to posecheck.sh
Step 5 : Transfer this file to your Ubuntu home directory (i use WinSCP for this)
Step 6 : chmod +x posecheck.sh
Step 7 : dos2unix posecheck.sh
(if dos2unix not installed, then install through sudo apt-get install dos2unix but on my Ubuntu system it was already installed)
Step 8 : ./posecheck.sh
'./posecheck.sh' command can now be used to have above commands in shell script executed automatically, with 1 second between each command.
Output :
Output handling for user :
* Be informed that llmq_60_75 needs to end with [31], if there is a lower number then wait and check from time to time untill it reached [31].
You should get a warning if the script does not find [31], urging you to not interrupt it.
* Use 'blocks to go before quorum restart' to see when is an opportune moment to stop your Masternode / Evonode, so you avoid getting hit with PoSe scores when llmq quorums get restarted again and possibly try to select your Masternode/Evonode, while Dashmate or dashd is still down on your server.
* Best viewed on a maximized PUTTY window
Same can be done with a Masternode / Evonode that has not been setup through Dashmate, but you will need to adjust both the path and the filename (~/.dashcore/debug.log ??) in above mentioned shell script, as logs from Dashmate differ in name and path.
From Windows :
Step 1 : Create a new text file
Step 2 : Add following text (last edited 15th of January 2024)
#!/bin/bash
echo
# Function to extract the highest block height
get_highest_value() {
local highest_value=$(tac ~/.dashmate/logs/mainnet/core.log | grep -o 'height=[0-9]*' | head -n 1 | cut -d '=' -f2)
echo "$highest_value"
}
# Function to get the height value for a specific quorum type
get_height_value() {
local quorum_type=$1
local result=$(tac ~/.dashmate/logs/mainnet/core.log | grep "quorum initialization OK for $quorum_type" | head -n 1)
if [[ -z "$result" ]]; then
echo -e "\e[31mError: Quorum initialization not found for $quorum_type\e[0m"
exit 1
fi
local height_value=$(echo "$result" | grep -o 'height\[[0-9]*\]' | head -n 1 | cut -d '[' -f2 | cut -d ']' -f1)
if [[ -z "$height_value" ]]; then
echo -e "\e[31mError: Failed to extract height value for $quorum_type\e[0m"
exit 1
fi
echo "$height_value"
}
# Main script
highest_value=$(get_highest_value)
echo -e "\e[36mCurrent Block Height : \e[36m$highest_value\e[0m"
sleep 1
echo
# Check llmq_60_75
result=$(tac ~/.dashmate/logs/mainnet/core.log | grep "quorum initialization OK for llmq_60_75" | head -n 1)
if [[ "$result" == *"llmq_60_75 qi[31]"* ]]; then
echo -e "\e[36mllmq quorum_60_75 reached final stage \e[32m[31]\e[36m\e[0m"
echo -e "\e[33mplease take quorum restarts into account\e[0m"
value2=$(get_height_value "llmq_60_75")
result2=$(echo "$value2+288-$highest_value" | bc 2>/dev/null)
if [[ "$result2" == "" ]]; then
echo -e "\e[31mError: Failed to calculate llmq_60_75 blocks to go before quorum restart\e[0m"
else
echo
echo -e "\e[36mllmq_60_75 blocks to go before quorum restart (interval 288) : $result2\e[0m"
fi
else
echo -e "\e[31m***** $result *****\e[0m"
echo -e "\e[31m***** llmq_60_75 is still in progress (not [31]), do not interrupt !! *****\e[0m"
echo
fi
sleep 1
# Check llmq_100_67
value3=$(get_height_value "llmq_100_67")
result3=$(echo "$value3+24-$highest_value" | bc 2>/dev/null)
if [[ "$result3" == "" ]]; then
echo -e "\e[31mError: Failed to calculate llmq_100_67 blocks to go before quorum restart\e[0m"
else
echo -e "\e[36mllmq_100_67 blocks to go before quorum restart (interval 24) : $result3\e[0m"
fi
# Check llmq_400_60
value4=$(get_height_value "llmq_400_60")
result4=$(echo "$value4+288-$highest_value" | bc 2>/dev/null)
if [[ "$result4" == "" ]]; then
echo -e "\e[31mError: Failed to calculate llmq_400_60 blocks to go before quorum restart\e[0m"
else
echo -e "\e[36mllmq_400_60 blocks to go before quorum restart (interval 288) : $result4\e[0m"
fi
echo
# Combined check at the end
if [[ "$result" == *"llmq_60_75 qi[31]"* && "$highest_value" != "$value2" && "$highest_value" != "$value3" && "$highest_value" != "$value4" ]]; then
echo -e "\e[32m***** All llmq quorums blockheights older than current blockheight & llmq_60_75 reached final stage [31] --> all quorums finished *****\e[0m"
else
echo -e "\e[31m***** Do not interrupt for now, 1 or more quorums not finished !! *****\e[0m"
fi
sleep 1
echo
Step 3 : Save as posecheck.txt
Step 4 : Rename to posecheck.sh
Step 5 : Transfer this file to your Ubuntu home directory (i use WinSCP for this)
Step 6 : chmod +x posecheck.sh
Step 7 : dos2unix posecheck.sh
(if dos2unix not installed, then install through sudo apt-get install dos2unix but on my Ubuntu system it was already installed)
Step 8 : ./posecheck.sh
'./posecheck.sh' command can now be used to have above commands in shell script executed automatically, with 1 second between each command.
Output :
Output handling for user :
* Be informed that llmq_60_75 needs to end with [31], if there is a lower number then wait and check from time to time untill it reached [31].
You should get a warning if the script does not find [31], urging you to not interrupt it.
* Use 'blocks to go before quorum restart' to see when is an opportune moment to stop your Masternode / Evonode, so you avoid getting hit with PoSe scores when llmq quorums get restarted again and possibly try to select your Masternode/Evonode, while Dashmate or dashd is still down on your server.
* Best viewed on a maximized PUTTY window
Same can be done with a Masternode / Evonode that has not been setup through Dashmate, but you will need to adjust both the path and the filename (~/.dashcore/debug.log ??) in above mentioned shell script, as logs from Dashmate differ in name and path.
Last edited: