mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-27 12:06:36 +02:00
updated testnet & raspiconfig
This commit is contained in:
@@ -2,15 +2,19 @@
|
|||||||
_temp="./download/dialog.$$"
|
_temp="./download/dialog.$$"
|
||||||
_error="./.error.out"
|
_error="./.error.out"
|
||||||
|
|
||||||
# load network and chain info
|
# load raspiblitz config data (with backup from old config)
|
||||||
network=`cat .network`
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
chain=$(sudo -bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
||||||
|
if [ ${#chain} -eq 0 ]; then
|
||||||
|
echo "gathering chain info ... please wait"
|
||||||
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** Precheck ***"
|
echo "*** Precheck ***"
|
||||||
|
|
||||||
# check if chain is in sync
|
# check if chain is in sync
|
||||||
chainInSync=$(lncli --chain=${network} getinfo | grep '"synced_to_chain": true' -c)
|
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
|
||||||
if [ ${chainInSync} -eq 0 ]; then
|
if [ ${chainInSync} -eq 0 ]; then
|
||||||
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
|
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
|
||||||
echo "Wait until chain is sync with LND and try again."
|
echo "Wait until chain is sync with LND and try again."
|
||||||
@@ -19,7 +23,7 @@ if [ ${chainInSync} -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check available funding
|
# check available funding
|
||||||
confirmedBalance=$(lncli --chain=${network} walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
confirmedBalance=$(lncli --chain=${network} --network=${chain}net walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
||||||
if [ ${confirmedBalance} -eq 0 ]; then
|
if [ ${confirmedBalance} -eq 0 ]; then
|
||||||
echo "FAIL - You have 0 SATOSHI in your confirmed LND On-Chain Wallet."
|
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."
|
echo "Please fund your on-chain wallet first and wait until confirmed."
|
||||||
@@ -28,7 +32,7 @@ if [ ${confirmedBalance} -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check number of connected peers
|
# check number of connected peers
|
||||||
numConnectedPeers=$(lncli --chain=${network} listpeers | grep pub_key -c)
|
numConnectedPeers=$(lncli --chain=${network} --network=${chain}net listpeers | grep pub_key -c)
|
||||||
if [ ${numConnectedPeers} -eq 0 ]; then
|
if [ ${numConnectedPeers} -eq 0 ]; then
|
||||||
echo "FAIL - no peers connected on lightning network"
|
echo "FAIL - no peers connected on lightning network"
|
||||||
echo "You can only open channels to peer nodes to connected to first."
|
echo "You can only open channels to peer nodes to connected to first."
|
||||||
@@ -44,7 +48,7 @@ do
|
|||||||
pubKey=$(echo ${grepLine} | cut -d '"' -f4)
|
pubKey=$(echo ${grepLine} | cut -d '"' -f4)
|
||||||
#echo "grepLine(${pubKey})"
|
#echo "grepLine(${pubKey})"
|
||||||
OPTIONS+=(${pubKey} "")
|
OPTIONS+=(${pubKey} "")
|
||||||
done < <(lncli --chain=${network} listpeers | grep pub_key)
|
done < <(lncli --chain=${network} --network=${chain}net listpeers | grep pub_key)
|
||||||
TITLE="Open (Payment) Channel"
|
TITLE="Open (Payment) Channel"
|
||||||
MENU="\nChoose a peer you connected to, to open the channel with: \n "
|
MENU="\nChoose a peer you connected to, to open the channel with: \n "
|
||||||
pubKey=$(dialog --clear \
|
pubKey=$(dialog --clear \
|
||||||
@@ -69,7 +73,7 @@ if [ "${network}" = "bitcoin" ]; then
|
|||||||
minSat=250000
|
minSat=250000
|
||||||
fi
|
fi
|
||||||
_error="./.error.out"
|
_error="./.error.out"
|
||||||
lncli --chain=${network} openchannel ${CHOICE} 1 0 2>$_error
|
lncli --chain=${network} openchannel --network=${chain}net ${CHOICE} 1 0 2>$_error
|
||||||
error=`cat ${_error}`
|
error=`cat ${_error}`
|
||||||
if [ $(echo "${error}" | grep "channel is too small" -c) -eq 1 ]; then
|
if [ $(echo "${error}" | grep "channel is too small" -c) -eq 1 ]; then
|
||||||
minSat=$(echo "${error}" | tr -dc '0-9')
|
minSat=$(echo "${error}" | tr -dc '0-9')
|
||||||
@@ -89,7 +93,7 @@ if [ ${#amount} -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# build command
|
# build command
|
||||||
command="lncli --chain=${network} openchannel ${pubKey} ${amount} 0"
|
command="lncli --chain=${network} --network=${chain}net openchannel ${pubKey} ${amount} 0"
|
||||||
|
|
||||||
# info output
|
# info output
|
||||||
clear
|
clear
|
||||||
|
Reference in New Issue
Block a user