From ab314255efc82fa139453dc59939d402a2a7854a Mon Sep 17 00:00:00 2001 From: ScuttoZ Date: Fri, 10 Apr 2026 16:23:43 +0200 Subject: [PATCH 1/2] stop_ln: replaced hardcoded path with (like in stop_nodes) and introduced failsafe to avoid errors if stop_ln is called before ever calling start_ln (in that case, stop_ln does nothing) --- contrib/startup_regtest.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/contrib/startup_regtest.sh b/contrib/startup_regtest.sh index 33cf5d36ba8c..55d0988e7e56 100755 --- a/contrib/startup_regtest.sh +++ b/contrib/startup_regtest.sh @@ -406,13 +406,14 @@ stop_nodes() { } stop_ln() { - stop_nodes "$@" - test ! -f "$BITCOIN_DIR/regtest/bitcoind.pid" || \ - (kill "$(cat "$BITCOIN_DIR/regtest/bitcoind.pid")"; \ - rm "$BITCOIN_DIR/regtest/bitcoind.pid") + network=${1:-regtest} + stop_nodes "$network" + test ! -f "$BITCOIN_DIR/$network/bitcoind.pid" || \ + (kill "$(cat "$BITCOIN_DIR/$network/bitcoind.pid")"; \ + rm "$BITCOIN_DIR/$network/bitcoind.pid") unset LN_NODES - unalias bt-cli + unalias bt-cli 2>/dev/null || true } node_info() { From 1c732b868a0e67a81bd6735e865040ef3a54b957 Mon Sep 17 00:00:00 2001 From: ScuttoZ Date: Fri, 10 Apr 2026 16:28:58 +0200 Subject: [PATCH 2/2] destroy_ln: added check to see if nodes are still running. The check asks the user to run stop_ln in case running nodes are found, aborts otherwise --- contrib/startup_regtest.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/startup_regtest.sh b/contrib/startup_regtest.sh index 55d0988e7e56..1a38d21b97a2 100755 --- a/contrib/startup_regtest.sh +++ b/contrib/startup_regtest.sh @@ -428,6 +428,14 @@ node_info() { } destroy_ln() { + if [ -n "$LN_NODES" ]; then + printf "Nodes are still running. Stop them now with stop_ln? [y/N] " + read -r yn + case "$yn" in + [Yy]*) stop_ln ;; + *) echo "Aborting. Call stop_ln before destroy_ln."; return 1 ;; + esac + fi rm -rf "$LIGHTNING_DIR"/l[0-9]* }