From d874741e6b28c3bbe628753b5ef07f22b6ec478c Mon Sep 17 00:00:00 2001 From: rootzoll Date: Wed, 5 Dec 2018 15:26:06 +0100 Subject: [PATCH] updated testnet & raspiconfig --- home.admin/BBopenChannel.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/home.admin/BBopenChannel.sh b/home.admin/BBopenChannel.sh index 649241d..be3a5cf 100755 --- a/home.admin/BBopenChannel.sh +++ b/home.admin/BBopenChannel.sh @@ -2,15 +2,19 @@ _temp="./download/dialog.$$" _error="./.error.out" -# load network and chain info -network=`cat .network` -chain=$(sudo -bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain') +# load raspiblitz config data (with backup from old config) +source /mnt/hdd/raspiblitz.conf 2>/dev/null +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 "*** Precheck ***" # 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 echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false" echo "Wait until chain is sync with LND and try again." @@ -19,7 +23,7 @@ if [ ${chainInSync} -eq 0 ]; then fi # 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 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 +32,7 @@ if [ ${confirmedBalance} -eq 0 ]; then fi # 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 echo "FAIL - no peers connected on lightning network" echo "You can only open channels to peer nodes to connected to first." @@ -44,7 +48,7 @@ do pubKey=$(echo ${grepLine} | cut -d '"' -f4) #echo "grepLine(${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" MENU="\nChoose a peer you connected to, to open the channel with: \n " pubKey=$(dialog --clear \ @@ -69,7 +73,7 @@ if [ "${network}" = "bitcoin" ]; then minSat=250000 fi _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}` if [ $(echo "${error}" | grep "channel is too small" -c) -eq 1 ]; then minSat=$(echo "${error}" | tr -dc '0-9') @@ -89,7 +93,7 @@ if [ ${#amount} -eq 0 ]; then fi # build command -command="lncli --chain=${network} openchannel ${pubKey} ${amount} 0" +command="lncli --chain=${network} --network=${chain}net openchannel ${pubKey} ${amount} 0" # info output clear