mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-10-02 05:09:14 +02:00
open channel first draft
This commit is contained in:
@@ -70,6 +70,7 @@ else
|
|||||||
OPTIONS+=(INFO "RaspiBlitz Status Screen" \
|
OPTIONS+=(INFO "RaspiBlitz Status Screen" \
|
||||||
FUNDING "Fund your Wallet" \
|
FUNDING "Fund your Wallet" \
|
||||||
CONNECT "Connect to a Peer" \
|
CONNECT "Connect to a Peer" \
|
||||||
|
CHANNEL "Open a Channel with Peer" \
|
||||||
lnbalance "Detailed Wallet Balances" \
|
lnbalance "Detailed Wallet Balances" \
|
||||||
lnchannels "Lightning Channel List" \
|
lnchannels "Lightning Channel List" \
|
||||||
SWITCH "Switch ${switchOption}"
|
SWITCH "Switch ${switchOption}"
|
||||||
@@ -136,6 +137,12 @@ case $CHOICE in
|
|||||||
read key
|
read key
|
||||||
./00mainMenu.sh
|
./00mainMenu.sh
|
||||||
;;
|
;;
|
||||||
|
FUNDING)
|
||||||
|
./BBopenChannel.sh
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
./00mainMenu.sh
|
||||||
|
;;
|
||||||
SWITCH)
|
SWITCH)
|
||||||
sudo ./95switchMainTest.sh
|
sudo ./95switchMainTest.sh
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
|
@@ -62,6 +62,7 @@ if [ ${#pubKey} -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# find out what is the minimum amount
|
# find out what is the minimum amount
|
||||||
|
# TODO find a better way - also consider dust and channel reserve
|
||||||
minSat=20000
|
minSat=20000
|
||||||
_error="./.error.out"
|
_error="./.error.out"
|
||||||
lncli openchannel ${CHOICE} 1 0 2>$_error
|
lncli openchannel ${CHOICE} 1 0 2>$_error
|
||||||
@@ -100,64 +101,21 @@ echo "RESULT:"
|
|||||||
# execute command
|
# execute command
|
||||||
result=$($command 2>$_error)
|
result=$($command 2>$_error)
|
||||||
error=`cat ${_error}`
|
error=`cat ${_error}`
|
||||||
|
|
||||||
echo "result(${result})"
|
echo "result(${result})"
|
||||||
echo "error(${error})"
|
echo "error(${error})"
|
||||||
|
|
||||||
exit 1
|
if [ ${#error} -gt 0 ]; then
|
||||||
|
|
||||||
# on no result
|
|
||||||
if [ ${#result} -eq 0 ]; then
|
|
||||||
|
|
||||||
# basic error
|
|
||||||
win=0
|
|
||||||
info="No return value. Error not known."
|
|
||||||
|
|
||||||
# try to get error output
|
|
||||||
result=`cat ${_error}`
|
|
||||||
echo "$result"
|
|
||||||
|
|
||||||
# basic cli error
|
|
||||||
cliError=$(echo "${result}" | grep "[lncli]" -c )
|
|
||||||
if [ ${cliError} -gt 0 ]; then
|
|
||||||
info="Its possible that LND daemon is not running, not configured correct or not connected to the lncli."
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# when result is available
|
|
||||||
echo "$result"
|
|
||||||
|
|
||||||
# check if the node is now in peer list
|
|
||||||
pubkey=$(echo $_input | cut -d '@' -f1)
|
|
||||||
isPeer=$(lncli listpeers 2>/dev/null| grep "${pubkey}" -c)
|
|
||||||
if [ ${isPeer} -eq 0 ]; then
|
|
||||||
|
|
||||||
# basic error message
|
|
||||||
win=0
|
|
||||||
info="Was not able to establish connection to node."
|
|
||||||
|
|
||||||
# TODO: try to find out more details from cli output
|
|
||||||
|
|
||||||
else
|
|
||||||
info="Perfect - a connection to that node got established :)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# output info
|
|
||||||
echo ""
|
|
||||||
if [ ${win} -eq 1 ]; then
|
|
||||||
echo "******************************"
|
|
||||||
echo "WIN"
|
|
||||||
echo "******************************"
|
|
||||||
echo "${info}"
|
|
||||||
echo ""
|
|
||||||
echo "Whats next? --> Open a channel with that node."
|
|
||||||
else
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
echo "FAIL"
|
echo "FAIL"
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
echo "${info}"
|
echo "${error}"
|
||||||
fi
|
else
|
||||||
|
echo "******************************"
|
||||||
|
echo "WIN"
|
||||||
|
echo "******************************"
|
||||||
|
echo "${result}"
|
||||||
|
echo ""
|
||||||
|
echo "Whats next? --> You need to wait 6 confirmations, for the channel to be ready."
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
Reference in New Issue
Block a user