Skip to content

Commit

Permalink
connect: correct variables
Browse files Browse the repository at this point in the history
  • Loading branch information
openoms committed Jan 3, 2021
1 parent e62d843 commit 5e28051
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions scripts/menu.bitcoinrpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ read rpc_port
}

function checkRPC {
echo "# Checking the remote RPC connection with curl..."
echo
tor=""
if [ $(echo $rpc_addr | grep -c .onion) -gt 0 ]; then
if [ $(echo $rpc_host | grep -c .onion) -gt 0 ]; then
tor="torify"
echo "# Connecting over Tor..."
echo
fi
$tor curl --data-binary \
'{"jsonrpc": "1.0", "id":"# Connected to bitcoinRPC successfully", "method": "getblockcount", "params": [] }' \
http://$rpc_user:$rpc_pass@$rpc_addr:$rpc_port
http://$rpc_user:$rpc_pass@$rpc_host:$rpc_port
}

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

if [ $(checkRPC 2>/dev/null | grep -c "bitcoinRPC") -gt 0 ]; then
echo
echo "# Connected to bitcoinRPC successfully"
echo
echo "# Blockheight on the connected node: $(checkRPC 2>/dev/null|grep "result"|cut -d":" -f2|cut -d"," -f1)"
Expand All @@ -50,8 +51,8 @@ if [ $(checkRPC 2>/dev/null | grep -c "bitcoinRPC") -gt 0 ]; then
read key
exit 0
else
echo
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:"
Expand Down
2 changes: 1 addition & 1 deletion scripts/menu.tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CHOICE=$(dialog --clear \
case $CHOICE in
CONNECT)
/home/joinmarket/menu.bitcoinrpc.sh
if [ "$1" -gt 0 ]; then
if ! connectedTrue; then
/home/joinmarket/menu.bitcoinrpc.sh
fi
echo
Expand Down
2 changes: 1 addition & 1 deletion scripts/start.joininbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if [ "$runningEnvEntry" -eq 0 ]; then

# connect to remote node
/home/joinmarket/menu.bitcoinrpc.sh
if [ "$1" -gt 0 ]; then
if ! connectedTrue; then
/home/joinmarket/menu.bitcoinrpc.sh
fi

Expand Down

0 comments on commit 5e28051

Please sign in to comment.