Skip to content

Commit

Permalink
Merge pull request #25 from LN-Zap/test-improvements
Browse files Browse the repository at this point in the history
Restart lndk after stack init
  • Loading branch information
mrfelton authored Jun 11, 2024
2 parents 29b7549 + 9471879 commit 4f64f7b
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

setup () {
$DIR/setup.sh

echo "Cleaning up from previous runs..."
docker compose down --volumes

echo
echo "Starting the stack..."
docker compose up -d
}

Expand Down Expand Up @@ -59,6 +64,10 @@ waitFor() {
fi
}

print_section() {
echo -e "\033[1;34m\n==================== $1 ====================\033[0m"
}

createBitcoindWallet() {
$DIR/../bin/bitcoin-cli createwallet default || $DIR/../bin/bitcoin-cli loadwallet default || true
}
Expand Down Expand Up @@ -281,7 +290,7 @@ waitForGraphSync() {
start_time=$(date +%s)
timeout=$((start_time + 600))

echo "Starting node graph validation. This could take a few minutes..."
echo "Initiating node graph validation. Please wait, this may take up to 10 minutes..."

# Loop until all nodes have an address or the timeout is reached
while true; do
Expand Down Expand Up @@ -339,9 +348,11 @@ waitForGraphSync() {
echo "All nodes have an address after $elapsed_time seconds"
}

# Helper function to print colored text
print_section() {
echo -e "\033[1;34m\n==================== $1 ====================\033[0m"
restartLndkNodes() {
docker-compose restart lndk1
docker-compose restart lndk2

echo "LNDK nodes restarted successfully."
}

main() {
Expand Down Expand Up @@ -377,6 +388,13 @@ main() {

print_section "VALIDATE NODE GRAPH"
waitForGraphSync

# This is a hack to work around onion message feature detection.
print_section "RESTARTING LNDK NODES"
restartLndkNodes

print_section "NODE INFO"
getNodeInfo
}

main

0 comments on commit 4f64f7b

Please sign in to comment.