/ tools / peer-heights
peer-heights
 1  #!/usr/bin/env bash
 2  
 3  # Requires: 'frk' script in PATH, and 'jq' utility installed
 4  
 5  set -e
 6  
 7  # Any extra args passed to us are also passed to 'frk', just prior to '-p peers'
 8  frk $@ -p peers | \
 9  	jq -r 'def lpad($len):
10  			tostring | ($len - length) as $l | (" " * $l)[:$l] + .;
11  		.[] |
12  			select(has("lastHeight")) |
13  			"\(.address | lpad(22)) (\(.version)), height \(.lastHeight), sig: \(.lastBlockSignature[0:8]), ts \(.lastBlockTimestamp / 1e3 | strftime("%Y-%m-%d %H:%M:%S"))"'