mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-03-27 02:01:53 +01:00
CLN catch offline channels in status (#4732)
This commit is contained in:
parent
22800056cb
commit
d816282ab6
@ -156,7 +156,7 @@ if [ "$2" = "info" ]; then
|
||||
# raw data demo:
|
||||
# sudo /usr/local/bin/lightning-cli --lightning-dir=/home/bitcoin/.lightning --conf=/home/bitcoin/.lightning/config getinfo
|
||||
|
||||
# get data
|
||||
# getinfo
|
||||
command="sudo -u bitcoin $lightningcli_alias getinfo"
|
||||
ln_getInfo=$(${command} 2>/dev/null)
|
||||
if [ "${ln_getInfo}" == "" ]; then
|
||||
@ -165,6 +165,15 @@ if [ "$2" = "info" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# listpeers
|
||||
command="sudo -u bitcoin $lightningcli_alias listpeers"
|
||||
ln_listpeers=$(${command} 2>/dev/null)
|
||||
if [ "${ln_listpeers}" == "" ]; then
|
||||
echo "command='${command}'"
|
||||
echo "error='no data'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# parse data
|
||||
cl_alias=$(echo "${ln_getInfo}" | grep '"alias":' | cut -d '"' -f4)
|
||||
port=$(echo "${ln_getInfo}" | grep '"port":' | cut -d: -f2 | tail -1 | bc)
|
||||
@ -176,9 +185,9 @@ if [ "$2" = "info" ]; then
|
||||
cl_address="${pubkey}@${address}:${port}"
|
||||
cl_tor=$(echo "${cl_address}" | grep -c ".onion")
|
||||
cl_channels_pending=$(echo "${ln_getInfo}" | jq -r '.num_pending_channels')
|
||||
cl_channels_active=$(echo "${ln_getInfo}" | jq -r '.num_active_channels')
|
||||
cl_channels_inactive=$(echo "${ln_getInfo}" | jq -r '.num_inactive_channels')
|
||||
cl_channels_total=$((cl_channels_pending + cl_channels_active + cl_channels_inactive))
|
||||
cl_channels_active=$(echo "${ln_listpeers}" | jq -r '[.peers[] | select(.connected == true)] | length')
|
||||
cl_channels_inactive=$(echo "${ln_listpeers}" | jq -r '[.peers[] | select(.connected == false)] | length')
|
||||
cl_channels_total=$((cl_channels_active + cl_channels_inactive))
|
||||
cl_peers=$(echo "${ln_getInfo}" | jq -r '.num_peers')
|
||||
cl_fees_collected_msat=$(echo "${ln_getInfo}" | jq -r '.fees_collected_msat')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user