Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart lndk after stack init #25

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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