Skip to content

Commit

Permalink
connect: ask for new values if unsuccessful
Browse files Browse the repository at this point in the history
  • Loading branch information
openoms committed Jan 3, 2021
1 parent b44052e commit 6269a7e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
18 changes: 16 additions & 2 deletions scripts/menu.bitcoinrpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ clear

generateJMconfig

function inputRPC {
echo "See how to prepare a remote node to accept the JoinMarket connection:"
echo "https://github.com/openoms/joininbox/blob/master/prepare_remote_node.md#prepare-a-remote-node-to-accept-the-joinmarket-connection"
echo
Expand All @@ -17,11 +18,11 @@ echo "Type or paste the LAN IP or .onion address of the remote node:"
read rpc_host
echo "Input the RPC port (8332 by default):"
read rpc_port
}

function checkRPC {
echo "# Checking the remote RPC connection with curl..."
echo

function checkRPC {
tor=""
if [ $(echo $rpc_addr | grep -c .onion) -gt 0 ]; then
tor="torify"
Expand All @@ -33,17 +34,30 @@ $tor curl --data-binary \
http://$rpc_user:$rpc_pass@$rpc_addr:$rpc_port
}

inputRPC
checkRPC

if [ $(checkRPC 2>/dev/null | grep -c "bitcoinRPC") -gt 0 ]; then
echo "# Connected to bitcoinRPC successfully"
echo
echo "# Blockheight on the connected node: $(checkRPC 2>/dev/null|grep "result"|cut -d":" -f2|cut -d"," -f1)"
echo
python /home/joinmarket/set.bitcoinrpc.py --rpc_user=$rpc_user --rpc_pass=$rpc_pass --rpc_host=$rpc_host --rpc_port=$rpc_port
echo
echo "# The bitcoinRPC connection settings are set in the joinmarket.cfg"
echo
echo "Press ENTER to continue"
read key
exit 0
else
echo "# Could not connect to bitcoinRPC with the error:"
echo
checkRPC
echo
echo "See how to prepare a remote node to accept the JoinMarket connection:"
echo "https://github.com/openoms/joininbox/blob/master/prepare_remote_node.md#prepare-a-remote-node-to-accept-the-joinmarket-connection"
echo
echo "Press ENTER to retry or CTLR+C to abort"
read key
exit 1
fi
7 changes: 5 additions & 2 deletions scripts/menu.tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,18 @@ CHOICE=$(dialog --clear \
case $CHOICE in
CONNECT)
/home/joinmarket/menu.bitcoinrpc.sh
echo ""
if [ "$1" -gt 0 ]; then
/home/joinmarket/menu.bitcoinrpc.sh
fi
echo
echo "Press ENTER to return to the menu..."
read key
;;
BOLTZMANN)
installBoltzmann
getTXID
python /home/joinmarket/start.boltzmann.py --txid=$(cat $txid)
echo ""
echo
echo "Press ENTER to return to the menu..."
read key
;;
Expand Down

0 comments on commit 6269a7e

Please sign in to comment.