Skip to content

Instantly share code, notes, and snippets.

@inigoflores
Last active January 31, 2022 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save inigoflores/4d929dc9efdf149319a6a7c07c9250af to your computer and use it in GitHub Desktop.
Save inigoflores/4d929dc9efdf149319a6a7c07c9250af to your computer and use it in GitHub Desktop.
Pisces - Get the lost witness ratio due to network problems
#!/bin/bash
echo "Checking the logs...\r\n"
total=$(grep -hE 'miner_onion_server:decrypt:{[0-9]+,[0-9]+} sending witness at RSSI' /home/pi/hnt/miner/log/console.log* |wc -l)
lost=$(cat /home/pi/hnt/miner/log/console.log* |grep "max retry" |wc -l)
delivered=$(grep -hE 'successfully sent witness to challenger' /home/pi/hnt/miner/log/console.log* | wc -l)
percentage=$(echo "print(round($lost/$total*100,2))" | python3)
echo "Witnesses\r";
echo "---------------------------------------";
echo "Total received = $total\r";
echo "Total lost = $lost\r";
echo "Total succesfuly delivered = $delivered\r\n";
echo "You are losing $percentage % of your witnesses due to network issues.\r\n";
@inigoflores
Copy link
Author

This can be due to blockchain p2p issues or an unstable Internet connection. Relayed hotspots acting as challengers normally fail to receive witnesses. Values under 10% are rather common. You should investigate the matter if the value goes above 15%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment