Skip to content

Commit

Permalink
startup-regtest: look for clnrest binary on startup
Browse files Browse the repository at this point in the history
Just check for the presence of the clnrest binary now.

Also update the string to check to the actual REST startup string
  • Loading branch information
niftynei authored and daywalker90 committed Aug 8, 2024
1 parent 8f4e715 commit 002daa8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions contrib/startup_regtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ wait_for_lightningd() {

clnrest_status() {
logfile="$1"
active_str="plugin-clnrest: REST Server is starting"
active_str="plugin-clnrest: REST server running"
disabled_str="plugin-clnrest: Killing plugin: disabled itself"

if grep -q "$active_str" "$logfile"; then
Expand All @@ -152,6 +152,11 @@ clnrest_status() {
fi
}

has_clnrest() {
test -x "$LIGHTNING_BIN/plugins/clnrest"
return $?
}

start_nodes() {
if [ -z "$1" ]; then
node_count=2
Expand Down Expand Up @@ -203,7 +208,7 @@ funder-lease-requests-only=false
EOF

# If clnrest loads, add the port so it will run
if [ -n "$ACTIVATE_CLNREST" ]; then
if has_clnrest; then
echo "clnrest-port=$((3109+i))" >> "$LIGHTNING_DIR/l$i/config"
fi

Expand Down Expand Up @@ -260,16 +265,12 @@ start_ln() {
else
nodes="$1"
fi
# Are the clnrest dependencies installed?
if timeout 2 python3 plugins/clnrest/clnrest > /dev/null 2>&1; then
ACTIVATE_CLNREST=1
fi
start_nodes "$nodes" regtest
echo " bt-cli, stop_ln, fund_nodes"

wait_for_lightningd "$nodes"
active_status=$(clnrest_status "$LIGHTNING_DIR/l1/log")
if [ -n "$ACTIVATE_CLNREST" ] && [ "$active_status" = "active" ] ; then
if has_clnrest && [ "$active_status" = "active" ] ; then
node_info regtest
elif [ "$active_status" = "disabled" ]; then
echo "clnrest is disabled."
Expand Down

0 comments on commit 002daa8

Please sign in to comment.