Skip to content

Commit 879473f

Browse files
niftyneidaywalker90
authored andcommitted
startup-regtest: look for clnrest binary on startup
Just check for the presence of the clnrest binary now. Also update the string to check to the actual REST startup string
1 parent 2316e5f commit 879473f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

contrib/startup_regtest.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ wait_for_lightningd() {
140140

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

146146
if grep -q "$active_str" "$logfile"; then
@@ -152,6 +152,11 @@ clnrest_status() {
152152
fi
153153
}
154154

155+
has_clnrest() {
156+
test -x "$LIGHTNING_BIN/plugins/clnrest"
157+
return $?
158+
}
159+
155160
start_nodes() {
156161
if [ -z "$1" ]; then
157162
node_count=2
@@ -203,7 +208,7 @@ funder-lease-requests-only=false
203208
EOF
204209

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

@@ -260,16 +265,12 @@ start_ln() {
260265
else
261266
nodes="$1"
262267
fi
263-
# Are the clnrest dependencies installed?
264-
if timeout 2 python3 plugins/clnrest/clnrest > /dev/null 2>&1; then
265-
ACTIVATE_CLNREST=1
266-
fi
267268
start_nodes "$nodes" regtest
268269
echo " bt-cli, stop_ln, fund_nodes"
269270

270271
wait_for_lightningd "$nodes"
271272
active_status=$(clnrest_status "$LIGHTNING_DIR/l1/log")
272-
if [ -n "$ACTIVATE_CLNREST" ] && [ "$active_status" = "active" ] ; then
273+
if has_clnrest && [ "$active_status" = "active" ] ; then
273274
node_info regtest
274275
elif [ "$active_status" = "disabled" ]; then
275276
echo "clnrest is disabled."

0 commit comments

Comments
 (0)