Skip to content

Commit

Permalink
regtest: error message if bitcoin-cli is not found
Browse files Browse the repository at this point in the history
If $BITCOIN_BIN is empty and bitcoin-cli or bitcoind are not found
startup_regtest will shutdown and display a corresponding error message.

Similarly if lightning-cli and lightningd are not found.
  • Loading branch information
Lagrang3 authored and cdecker committed Feb 2, 2024
1 parent 3c9fd0c commit 9abd5ec
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions contrib/startup_regtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
# We've got a legacy problem is that PATH_TO_LIGHTNING is the
# path to the lightningd / lightning-cli and PATH_TO_BITCOIN
# is the path to the bitcoin data dir. These are not the same
# things (data directories vs binary locations).
# things (data directories vs binary locations).
# Ideally we'd let users set each of these four
# things independently. Unless we rename stuff, this going to
# be problematic.
# be problematic.
#
# Instead we rename them and throw up
# if you're using the old ones.
Expand All @@ -56,10 +56,14 @@ fi

if [ -z "$LIGHTNING_BIN" ]; then
# Already installed maybe? Prints
# shellcheck disable=SC2039
type lightning-cli >/dev/null 2>&1 || return
# shellcheck disable=SC2039
type lightningd >/dev/null 2>&1 || return
if [ ! "$(type lightning-cli >/dev/null 2>&1)" ]; then
echo lightning-cli: not found
return 1
fi
if [ ! "$(type lightningd >/dev/null 2>&1)" ]; then
echo lightningd: not found
return 1
fi
LCLI=lightning-cli
LIGHTNINGD=lightningd
else
Expand Down Expand Up @@ -89,10 +93,14 @@ fi
# shellcheck disable=SC2153
if [ -z "$BITCOIN_BIN" ]; then
# Already installed maybe? Prints
# shellcheck disable=SC2039
type bitcoin-cli >/dev/null 2>&1 || return
# shellcheck disable=SC2039
type bitcoind >/dev/null 2>&1 || return
if [ ! "$(type bitcoin-cli >/dev/null 2>&1)" ]; then
echo bitcoin-cli: not found
return 1
fi
if [ ! "$(type bitcoind >/dev/null 2>&1)" ]; then
echo bitcoind: not found
return 1
fi
BCLI=bitcoin-cli
BITCOIND=bitcoind
else
Expand Down

0 comments on commit 9abd5ec

Please sign in to comment.