lnd/scripts/bw-compatibility-test/test.sh
ziggie f6f6064938
scripts: fix backwards compatibility test timing issues
The backwards compatibility test was failing intermittently due to two
related timing issues in the test setup.

The issue was that Dave's `wait_graph_sync dave 3` was hanging
for up to 60 minutes. Dave's initial gossip sync with Charlie could
complete before Charlie had forwarded the alice-bob channel
announcement, leaving Dave stuck at 2 channels until lnd's historical
syncer fired at its default interval of 1 hour. After this 1-hour idle,
some routing state had become stale, causing the subsequent payment from
alice to dave to fail with FAILURE_REASON_NO_ROUTE.

This issues is now addressed by setting `--historicalsyncinterval=10s` on
all nodes. This causes nodes to periodically re-sync the full gossip
state from their peers every 10 seconds instead of every hour. Dave
therefore picks up any missed channel announcements and routing policies
within seconds, and alice's routing graph stays up-to-date throughout
the test.

Additionally, lnd debug logs from all containers are now collected
before teardown on failure and uploaded as a CI artifact, making future
failures easier to diagnose.
2026-03-04 13:04:26 +01:00

69 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
# Stop the script if an error is returned by any step.
set -e
# DIR is set to the directory of this script.
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$DIR/compose.sh"
source "$DIR/network.sh"
source "$DIR/.env"
cd $DIR
# Spin up the network in detached mode.
compose_up
# Ensure that the cluster is shut down when the script exits
# regardless of success. Logs are collected first so they are
# available for CI artifact upload after the cluster is torn down.
trap 'collect_logs; compose_down' EXIT
# Set up the network.
setup_network
# Print the initial version of each node.
do_for print_version alice bob charlie dave
# Test that Bob can send a multi-hop payment.
send_payment bob dave
# Test that Bob can receive a multi-hop payment.
send_payment dave bob
# Test that Bob can route a payment.
send_payment alice dave
# Upgrade the compose variables so that the Bob configuration
# is swapped out for the PR version.
upgrade_node bob
# Wait for Bob to start.
wait_for_node bob
wait_for_active_chans bob 2
# Show that Bob is now running the current branch.
do_for print_version bob
# Repeat the basic tests.
send_payment bob dave
send_payment dave bob
send_payment alice dave
# Upgrade the compose variables so that the Dave configuration
# is swapped out for the PR version.
upgrade_node dave
wait_for_node dave
wait_for_active_chans dave 1
# Show that Dave is now running the current branch.
do_for print_version dave
# Repeat the basic tests (after potential migraton).
send_payment bob dave
send_payment dave bob
send_payment alice dave
echo "🛡️⚔️🫡 Backwards compatibility test passed! 🫡⚔️🛡️"