Browse Source

updated for testnet and raspiconfig

#146
rootzoll 6 years ago
parent
commit
0a292da1f1
  1. 18
      home.admin/BBcreateInvoice.sh
  2. 2
      home.admin/BBfundWallet.sh
  3. 16
      home.admin/BBpayInvoice.sh

18
home.admin/BBcreateInvoice.sh

@ -3,15 +3,19 @@ _temp="./download/dialog.$$"
_error="./.error.out"
sudo chmod 7777 ${_error}
# 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 "!!!!!!!!!!!!!!!!!!!"
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
@ -23,7 +27,7 @@ fi
# check number of connected peers
echo "check for open channels"
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} listchannels 2>/dev/null | grep chan_id -c)
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
if [ ${openChannels} -eq 0 ]; then
echo ""
echo "!!!!!!!!!!!!!!!!!!!"
@ -46,7 +50,7 @@ if [ ${#amount} -eq 0 ]; then
fi
# build command
command="lncli --chain=${network} addinvoice ${amount}"
command="lncli --chain=${network} --network=${chain}net addinvoice ${amount}"
# info output
clear
@ -84,7 +88,7 @@ else
echo ""
echo ${payReq}
echo ""
echo "You can use 'lncli --chain=${network} lookupinvoice ${rhash}' to check the payment. "
echo "You can use 'lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}' to check the payment. "
# TODO: Offer to go into monitor for incommin payment loop.

2
home.admin/BBfundWallet.sh

@ -63,6 +63,6 @@ echo "Send ${coininfo} to address --> ${address}"
if [ "$chain" = "test" ]; then
echo "get some testnet coins from https://testnet-faucet.mempool.co"
fi
echo "Whats next? --> Wait for confirmations. You can use lnbalance for main menu or info on LCD to check if funds have arrived."
echo "Whats next? --> Wait for confirmations. You can use info on LCD to check if funds have arrived."
echo "If you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'"
echo ""

16
home.admin/BBpayInvoice.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 "!!!!!!!!!!!!!!!!!!!"
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
@ -23,7 +27,7 @@ fi
# check number of connected peers
echo "check for open channels"
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} listchannels 2>/dev/null | grep chan_id -c)
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
if [ ${openChannels} -eq 0 ]; then
echo ""
echo "!!!!!!!!!!!!!!!!!!!"
@ -71,7 +75,7 @@ fi
# TODO: maybe try/show the decoded info first by using https://api.lightning.community/#decodepayreq
# build command
command="lncli --chain=${network} sendpayment --force --pay_req=${invoice}"
command="lncli --chain=${network} --network=${chain}net sendpayment --force --pay_req=${invoice}"
# info output
clear

Loading…
Cancel
Save