Created
June 29, 2019 03:37
-
-
Save tyzbit/7196619abe2072fa0e79d4f48fca735a to your computer and use it in GitHub Desktop.
Use arrow keys to browse through your LND's forwarding history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## change if necessary to point to your node | |
lncli="lncli --rpcserver localhost:10009" | |
function fwdinghistory() { | |
$lncli fwdinghistory \ | |
--start_time=$start \ | |
--end_time=$end \ | |
--index_offset=$offset \ | |
--max_events=$events \ | |
| jq '.forwarding_events[].timestamp |= (. | tonumber | strftime("%F %T")) | | |
.total_event_count = '$offset' + (.forwarding_events | length) | | |
.forwarding_events[].amt_in |= (. | tonumber) | | |
.forwarding_events[].amt_out |= (. | tonumber)' | |
} | |
start=1 | |
end=$(date +%s) | |
offset=0 | |
events=6 | |
nav_help="[ Use left and right arrow keys to navigate ]\n" | |
clear | |
echo -e "$nav_help" | |
fwdinghistory | |
while read -r -sn1 key; do | |
case "$key" in | |
# arrow right | |
'C') | |
let offset=offset+$events | |
;; | |
# arrow left | |
'D') | |
let offset=offset-$events | |
;; | |
'q') break | |
;; | |
esac | |
clear | |
echo -e "$nav_help" | |
fwdinghistory | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment