From 0a58aa62b627d062f6eaa73b816a503410b93c65 Mon Sep 17 00:00:00 2001 From: Alex Myers Date: Thu, 9 Nov 2023 15:07:41 -0600 Subject: [PATCH] startup_regtest: configure clnrest and generate rune This allows use of clnrest + websocket in the regtest environment. Also uses the snap installed bitcoind path if appropriate. Format of the start_ln output is: Commands: l1-cli, l1-log, l2-cli, l2-log, bt-cli, stop_ln, fund_nodes Node Info: l1 rest: https://127.0.0.1:3110 rune: "lgkWSp0PQK-pkbElLpjcNVQnX7yfEjouJaJHjLuW8w89OA==" l2 rest: https://127.0.0.1:3111 rune: "sUqGqkevGYG2r1e_JUiz8Me00GhtTv5-IuGk4o9Beyc9OQ==" Changelog-None --- contrib/startup_regtest.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/contrib/startup_regtest.sh b/contrib/startup_regtest.sh index 838baec39591..7cbfb94c1f2a 100755 --- a/contrib/startup_regtest.sh +++ b/contrib/startup_regtest.sh @@ -49,7 +49,9 @@ else fi if [ -z "$PATH_TO_BITCOIN" ]; then - if [ -d "$HOME/.bitcoin" ]; then + if [ -d "$HOME/snap/bitcoin-core/common/.bitcoin" ]; then + PATH_TO_BITCOIN="$HOME/snap/bitcoin-core/common/.bitcoin" + elif [ -d "$HOME/.bitcoin" ]; then PATH_TO_BITCOIN="$HOME/.bitcoin" elif [ -d "$HOME/Library/Application Support/Bitcoin/" ]; then PATH_TO_BITCOIN="$HOME/Library/Application Support/Bitcoin/" @@ -92,6 +94,7 @@ start_nodes() { log-file=/tmp/l$i-$network/log addr=localhost:$socket allow-deprecated-apis=false + rest-port=$((3109+i)) EOF # If we've configured to use developer, add dev options @@ -127,8 +130,10 @@ start_nodes() { if [ -z "$EATMYDATA" ]; then echo "WARNING: eatmydata not found: install it for faster testing" fi + sleep 2 # Give a hint. echo "Commands: " + for i in $(seq "$node_count"); do echo " l$i-cli, l$i-log," done @@ -169,6 +174,7 @@ start_ln() { fi start_nodes "$nodes" regtest echo " bt-cli, stop_ln, fund_nodes" + node_info regtest } ensure_bitcoind_funds() { @@ -292,6 +298,17 @@ stop_ln() { unalias bt-cli } +node_info() { + network=${1:-regtest} + if [ -n "$LN_NODES" ]; then + echo "Node Info:" + for i in $(seq "$LN_NODES"); do + echo " l$i rest: https://127.0.0.1:$((3109 + i))"\ + " rune: $($LCLI --lightning-dir=/tmp/l"$i-$network" createrune | jq .rune)" + done + fi +} + destroy_ln() { network=${1:-regtest} rm -rf /tmp/l[0-9]*-"$network"