fix openchannels check or cln in menu (#4751)

* shellcheck format BBpayInvoice
* fix openchannels check for cl
* shellcheck format + fix CLN check for channels in BBcreateInvoice
* nit: use paid correctly
* enhance summars plugin output
This commit is contained in:
openoms 2024-09-26 08:13:22 +02:00 committed by GitHub
parent fa9ff68760
commit 731aa73128
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 56 additions and 57 deletions

View File

@ -49,7 +49,7 @@ done
# check number of connected peers
echo "check for open channels"
if [ $LNTYPE = cl ]; then
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
openChannels=$($lightningcli_alias getinfo | jq .num_active_channels)
elif [ $LNTYPE = lnd ]; then
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
fi
@ -148,16 +148,15 @@ else
fi
echo "Press x and hold to skip to menu."
while :
do
while :; do
if [ $LNTYPE = cl ]; then
result=$($lightningcli_alias waitinvoice $label)
wasPayed=$(echo $result | grep -c 'paid')
wasPaid=$(echo $result | grep -c 'paid')
elif [ $LNTYPE = lnd ]; then
result=$($lncli_alias lookupinvoice ${rhash})
wasPayed=$(echo $result | grep -c '"settled": true')
wasPaid=$(echo $result | grep -c '"settled": true')
fi
if [ ${wasPayed} -gt 0 ]; then
if [ ${wasPaid} -gt 0 ]; then
echo
echo $result
echo
@ -176,7 +175,7 @@ else
echo
echo $result
echo
echo "Returning to menu - invoice was not payed yet."
echo "Returning to menu - the invoice has not been paid yet."
break
fi

View File

@ -48,7 +48,7 @@ done
# check number of connected peers
echo "check for open channels"
if [ $LNTYPE = cl ]; then
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
openChannels=$($lightningcli_alias getinfo | jq .num_active_channels)
elif [ $LNTYPE = lnd ]; then
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
fi

View File

@ -34,9 +34,9 @@ fi
echo
echo "# Running:"
echo "${netprefix}lightning-cli -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS summars-sort-by=IN_SATS"
echo "${netprefix}lightning-cli -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS,FLAG,BASE,PPM,UPTIME,HTLCS,STATE summars-sort-by=-IN_SATS"
echo
$lightningcli_alias -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS summars-sort-by=IN_SATS
$lightningcli_alias -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS,FLAG,BASE,PPM,UPTIME,HTLCS,STATE summars-sort-by=-IN_SATS
echo
if [ "$(echo "$@" | grep -c "runonce")" -gt 0 ]; then