mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-11 21:29:29 +02:00
added chain parameter to lncli
This commit is contained in:
parent
a21c157bc5
commit
56ad6ac11a
@ -70,7 +70,7 @@ if [ "$USER" = "pi" ]; then
|
||||
# get chain if not available before
|
||||
chain=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>/dev/null | jq -r '.chain')
|
||||
fi
|
||||
lndSynced=$(sudo -u bitcoin /usr/local/bin/lncli getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
|
||||
lndSynced=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
|
||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null | grep -c unlock)
|
||||
|
||||
if [ ${locked} -gt 0 ]; then
|
||||
|
@ -95,7 +95,7 @@ else
|
||||
MOBILE "Connect Mobile Wallet")
|
||||
|
||||
# Depending Options
|
||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli listchannels 2>/dev/null | grep chan_id -c)
|
||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} listchannels 2>/dev/null | grep chan_id -c)
|
||||
if [ ${openChannels} -gt 0 ]; then
|
||||
OPTIONS+=(CLOSEALL "Close all open Channels")
|
||||
fi
|
||||
|
@ -67,7 +67,7 @@ if [ ${lndRunning} -eq 1 ]; then
|
||||
fi
|
||||
|
||||
# check if lnd is scanning blockchain
|
||||
lndInfo=$(sudo -u bitcoin /usr/local/bin/lncli getinfo | grep "synced_to_chain")
|
||||
lndInfo=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} getinfo | grep "synced_to_chain")
|
||||
lndSyncing=1
|
||||
if [ ${#lndInfo} -gt 0 ];then
|
||||
lndSyncing=$(echo "${chainInfo}" | grep "false" -c)
|
||||
|
@ -127,11 +127,11 @@ Press OK and follow the 'Helping Instructions'.
|
||||
echo "C) For 'passphrase' to encrypt your 'cipher seed' use PASSWORD D (optional)"
|
||||
echo "****************************************************************************"
|
||||
echo ""
|
||||
echo "lncli create"
|
||||
echo "lncli --chain=${network} create"
|
||||
|
||||
# execute command and monitor error
|
||||
_error="./.error.out"
|
||||
sudo -u bitcoin /usr/local/bin/lncli create 2>$_error
|
||||
sudo -u bitcoin /usr/local/bin/lncli --chain=${network} create 2>$_error
|
||||
error=`cat ${_error}`
|
||||
|
||||
if [ ${#error} -gt 0 ]; then
|
||||
@ -209,7 +209,7 @@ fi
|
||||
echo ""
|
||||
echo "*** Check LND Sync ***"
|
||||
item=0
|
||||
lndSyncing=$(sudo -u bitcoin /usr/local/bin/lncli getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
|
||||
lndSyncing=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
|
||||
if [ ${lndSyncing} -eq 0 ]; then
|
||||
echo "OK - wait for LND to be synced"
|
||||
while :
|
||||
@ -220,7 +220,7 @@ if [ ${lndSyncing} -eq 0 ]; then
|
||||
sleep 15
|
||||
|
||||
# break loop when synced
|
||||
lndSyncing=$(sudo -u bitcoin /usr/local/bin/lncli getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
|
||||
lndSyncing=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
|
||||
if [ ${lndSyncing} -eq 1 ]; then
|
||||
break
|
||||
fi
|
||||
|
@ -61,11 +61,11 @@ lndInstalled=$(systemctl status lnd.service | grep loaded -c)
|
||||
if [ ${lndInstalled} -gt 0 ]; then
|
||||
|
||||
echo "check for open channels"
|
||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli listchannels 2>/dev/null | grep chan_id -c)
|
||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} listchannels 2>/dev/null | grep chan_id -c)
|
||||
if [ ${openChannels} -gt 0 ]; then
|
||||
echo ""
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo "FAIL - You have still open channels and could loose funds !! - close those first with 'lncli closeallchannels' or main menu option."
|
||||
echo "FAIL - You have still open channels and could loose funds !! - close those first with 'lncli --chain=${network} closeallchannels' or main menu option."
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
exit 1
|
||||
else
|
||||
|
@ -5,14 +5,14 @@ network=`cat .network`
|
||||
|
||||
echo ""
|
||||
echo "****************************************************************************"
|
||||
echo "Unlock LND Wallet --> lncli unlock"
|
||||
echo "Unlock LND Wallet --> lncli --chain=${network} unlock"
|
||||
echo "****************************************************************************"
|
||||
echo "HELP: Enter your PASSWORD C"
|
||||
echo "****************************************************************************"
|
||||
while :
|
||||
do
|
||||
chain="$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')"
|
||||
sudo -u bitcoin /usr/local/bin/lncli unlock
|
||||
sudo -u bitcoin /usr/local/bin/lncli --chain=${network} unlock
|
||||
sleep 4
|
||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -c unlock)
|
||||
if [ ${locked} -eq 0 ]; then
|
||||
|
@ -7,7 +7,7 @@ network=`cat .network`
|
||||
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
||||
|
||||
# get available amount in on-chain wallet
|
||||
maxAmount=$(lncli walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
||||
maxAmount=$(lncli --chain=${network} walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
||||
|
||||
# TODO: pre-check if channels are open or are still in closing
|
||||
# and let user know not all funds are available yet (just info Dialoge)
|
||||
@ -44,7 +44,7 @@ fi
|
||||
|
||||
# TODO: check if fees are getting done right so that transaction will get processed
|
||||
|
||||
command="lncli sendcoins --conf_target 3 ${address} ${amount}"
|
||||
command="lncli --chain=${network} --conf_target 3 sendcoins ${address} ${amount}"
|
||||
|
||||
clear
|
||||
echo "******************************"
|
||||
|
@ -4,7 +4,7 @@
|
||||
network=`cat .network`
|
||||
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
||||
|
||||
command="lncli closeallchannels --force"
|
||||
command="lncli --chain=${network} --force closeallchannels "
|
||||
|
||||
clear
|
||||
echo "***********************************"
|
||||
@ -17,7 +17,7 @@ echo ""
|
||||
echo "RESULT:"
|
||||
|
||||
# PRECHECK) check if chain is in sync
|
||||
chainInSync=$(lncli getinfo | grep '"synced_to_chain": true' -c)
|
||||
chainInSync=$(lncli --chain=${network} getinfo | grep '"synced_to_chain": true' -c)
|
||||
if [ ${chainInSync} -eq 0 ]; then
|
||||
command=""
|
||||
result="FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
|
||||
|
@ -29,7 +29,7 @@ if [ ${#_input} -eq 0 ]; then
|
||||
fi
|
||||
|
||||
# build command
|
||||
command="lncli connect ${_input}"
|
||||
command="lncli --chain=${network} connect ${_input}"
|
||||
|
||||
# info output
|
||||
clear
|
||||
@ -88,7 +88,7 @@ else
|
||||
|
||||
# check if the node is now in peer list
|
||||
pubkey=$(echo $_input | cut -d '@' -f1)
|
||||
isPeer=$(lncli listpeers 2>/dev/null| grep "${pubkey}" -c)
|
||||
isPeer=$(lncli --chain=${network} listpeers 2>/dev/null| grep "${pubkey}" -c)
|
||||
if [ ${isPeer} -eq 0 ]; then
|
||||
|
||||
# basic error message
|
||||
|
@ -10,7 +10,7 @@ echo ""
|
||||
echo "*** Precheck ***"
|
||||
|
||||
# check if chain is in sync
|
||||
chainInSync=$(lncli getinfo | grep '"synced_to_chain": true' -c)
|
||||
chainInSync=$(lncli --chain=${network} getinfo | grep '"synced_to_chain": true' -c)
|
||||
if [ ${chainInSync} -eq 0 ]; then
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
|
||||
@ -22,7 +22,7 @@ fi
|
||||
|
||||
# check number of connected peers
|
||||
echo "check for open channels"
|
||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli listchannels 2>/dev/null | grep chan_id -c)
|
||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} listchannels 2>/dev/null | grep chan_id -c)
|
||||
if [ ${openChannels} -eq 0 ]; then
|
||||
echo ""
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
@ -45,7 +45,7 @@ if [ ${#amount} -eq 0 ]; then
|
||||
fi
|
||||
|
||||
# build command
|
||||
command="lncli addinvoice ${amount}"
|
||||
command="lncli --chain=${network} addinvoice ${amount}"
|
||||
|
||||
# info output
|
||||
clear
|
||||
@ -83,7 +83,7 @@ else
|
||||
echo ""
|
||||
echo ${payReq}
|
||||
echo ""
|
||||
echo "You can use 'lncli lookupinvoice ${rhash}' to check the payment. "
|
||||
echo "You can use 'lncli --chain=${network} lookupinvoice ${rhash}' to check the payment. "
|
||||
|
||||
# TODO: Offer to go into monitor for incommin payment loop.
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
network=`cat .network`
|
||||
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
||||
|
||||
command="lncli newaddress np2wkh"
|
||||
command="lncli --chain=${network} newaddress np2wkh"
|
||||
|
||||
clear
|
||||
echo "******************************"
|
||||
@ -17,7 +17,7 @@ echo ""
|
||||
echo "RESULT:"
|
||||
|
||||
# PRECHECK) check if chain is in sync
|
||||
chainInSync=$(lncli getinfo | grep '"synced_to_chain": true' -c)
|
||||
chainInSync=$(lncli --chain=${network} getinfo | grep '"synced_to_chain": true' -c)
|
||||
if [ ${chainInSync} -eq 0 ]; then
|
||||
command=""
|
||||
result="FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
|
||||
|
@ -10,7 +10,7 @@ echo ""
|
||||
echo "*** Precheck ***"
|
||||
|
||||
# check if chain is in sync
|
||||
chainInSync=$(lncli getinfo | grep '"synced_to_chain": true' -c)
|
||||
chainInSync=$(lncli --chain=${network} getinfo | grep '"synced_to_chain": true' -c)
|
||||
if [ ${chainInSync} -eq 0 ]; then
|
||||
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
|
||||
echo "Wait until chain is sync with LND and try again."
|
||||
@ -19,7 +19,7 @@ if [ ${chainInSync} -eq 0 ]; then
|
||||
fi
|
||||
|
||||
# check available funding
|
||||
confirmedBalance=$(lncli walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
||||
confirmedBalance=$(lncli --chain=${network} walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
||||
if [ ${confirmedBalance} -eq 0 ]; then
|
||||
echo "FAIL - You have 0 SATOSHI in your confirmed LND On-Chain Wallet."
|
||||
echo "Please fund your on-chain wallet first and wait until confirmed."
|
||||
@ -28,7 +28,7 @@ if [ ${confirmedBalance} -eq 0 ]; then
|
||||
fi
|
||||
|
||||
# check number of connected peers
|
||||
numConnectedPeers=$(lncli listpeers | grep pub_key -c)
|
||||
numConnectedPeers=$(lncli --chain=${network} listpeers | grep pub_key -c)
|
||||
if [ ${numConnectedPeers} -eq 0 ]; then
|
||||
echo "FAIL - no peers connected on lightning network"
|
||||
echo "You can only open channels to peer nodes to connected to first."
|
||||
@ -44,7 +44,7 @@ do
|
||||
pubKey=$(echo ${grepLine} | cut -d '"' -f4)
|
||||
#echo "grepLine(${pubKey})"
|
||||
OPTIONS+=(${pubKey} "")
|
||||
done < <(lncli listpeers | grep pub_key)
|
||||
done < <(lncli --chain=${network} listpeers | grep pub_key)
|
||||
TITLE="Open (Payment) Channel"
|
||||
MENU="\nChoose a peer you connected to, to open the channel with: \n "
|
||||
pubKey=$(dialog --clear \
|
||||
@ -69,7 +69,7 @@ if [ "${network}" = "bitcoin" ]; then
|
||||
minSat=250000
|
||||
fi
|
||||
_error="./.error.out"
|
||||
lncli openchannel ${CHOICE} 1 0 2>$_error
|
||||
lncli --chain=${network} openchannel ${CHOICE} 1 0 2>$_error
|
||||
error=`cat ${_error}`
|
||||
if [ $(echo "${error}" | grep "channel is too small" -c) -eq 1 ]; then
|
||||
minSat=$(echo "${error}" | tr -dc '0-9')
|
||||
@ -89,7 +89,7 @@ if [ ${#amount} -eq 0 ]; then
|
||||
fi
|
||||
|
||||
# build command
|
||||
command="lncli openchannel ${pubKey} ${amount} 0"
|
||||
command="lncli --chain=${network} openchannel ${pubKey} ${amount} 0"
|
||||
|
||||
# info output
|
||||
clear
|
||||
|
@ -10,7 +10,7 @@ echo ""
|
||||
echo "*** Precheck ***"
|
||||
|
||||
# check if chain is in sync
|
||||
chainInSync=$(lncli getinfo | grep '"synced_to_chain": true' -c)
|
||||
chainInSync=$(lncli --chain=${network} getinfo | grep '"synced_to_chain": true' -c)
|
||||
if [ ${chainInSync} -eq 0 ]; then
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
|
||||
@ -23,7 +23,7 @@ fi
|
||||
|
||||
# check number of connected peers
|
||||
echo "check for open channels"
|
||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli listchannels 2>/dev/null | grep chan_id -c)
|
||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} listchannels 2>/dev/null | grep chan_id -c)
|
||||
if [ ${openChannels} -eq 0 ]; then
|
||||
echo ""
|
||||
echo "!!!!!!!!!!!!!!!!!!!"
|
||||
@ -71,7 +71,7 @@ fi
|
||||
# TODO: maybe try/show the decoded info first by using https://api.lightning.community/#decodepayreq
|
||||
|
||||
# build command
|
||||
command="lncli sendpayment --pay_req=${invoice}"
|
||||
command="lncli --chain=${network} sendpayment --pay_req=${invoice}"
|
||||
|
||||
# info output
|
||||
clear
|
||||
|
Loading…
x
Reference in New Issue
Block a user