From f6f6064938128c93ce5f88f84e3225694b137c19 Mon Sep 17 00:00:00 2001 From: ziggie Date: Mon, 2 Mar 2026 19:45:56 +0100 Subject: [PATCH] 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. --- .github/workflows/main.yml | 8 ++++++++ .../docker-compose.override.yaml | 2 ++ .../bw-compatibility-test/docker-compose.yaml | 4 ++++ scripts/bw-compatibility-test/network.sh | 18 ++++++++++++++++++ scripts/bw-compatibility-test/test.sh | 5 +++-- 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d5bba990..4d54c1d14 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -602,6 +602,14 @@ jobs: - name: 🛡️ Backwards compatibility test run: make backwards-compat-test + - name: 📋 Upload node logs on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: bw-compat-logs + path: scripts/bw-compatibility-test/logs/ + retention-days: 7 + ######################################### # Auto Cache Cleanup on Pull Requests ######################################### diff --git a/scripts/bw-compatibility-test/docker-compose.override.yaml b/scripts/bw-compatibility-test/docker-compose.override.yaml index 51ca758b9..59dc9830f 100644 --- a/scripts/bw-compatibility-test/docker-compose.override.yaml +++ b/scripts/bw-compatibility-test/docker-compose.override.yaml @@ -42,6 +42,7 @@ services: --protocol.zero-conf --protocol.simple-taproot-chans --trickledelay=50 + --historicalsyncinterval=10s dave-pr: image: lnd-dev:backward-compat-test-build @@ -83,5 +84,6 @@ services: --protocol.zero-conf --protocol.simple-taproot-chans --trickledelay=50 + --historicalsyncinterval=10s --db.backend=sqlite --db.use-native-sql diff --git a/scripts/bw-compatibility-test/docker-compose.yaml b/scripts/bw-compatibility-test/docker-compose.yaml index 7860b4415..ea901e699 100644 --- a/scripts/bw-compatibility-test/docker-compose.yaml +++ b/scripts/bw-compatibility-test/docker-compose.yaml @@ -71,6 +71,7 @@ services: - "--protocol.zero-conf" - "--protocol.simple-taproot-chans" - "--trickledelay=50" + - "--historicalsyncinterval=10s" bob: image: lightninglabs/lnd:${LND_LATEST_VERSION} @@ -111,6 +112,7 @@ services: - "--protocol.zero-conf" - "--protocol.simple-taproot-chans" - "--trickledelay=50" + - "--historicalsyncinterval=10s" charlie: image: lightninglabs/lnd:${LND_LATEST_VERSION} @@ -148,6 +150,7 @@ services: - "--tlsextradomain=charlie" - "--accept-keysend" - "--trickledelay=50" + - "--historicalsyncinterval=10s" dave: image: lightninglabs/lnd:${LND_LATEST_VERSION} @@ -185,6 +188,7 @@ services: - "--tlsextradomain=dave" - "--accept-keysend" - "--trickledelay=50" + - "--historicalsyncinterval=10s" - "--db.backend=sqlite" - "--db.use-native-sql" diff --git a/scripts/bw-compatibility-test/network.sh b/scripts/bw-compatibility-test/network.sh index 98eca675b..c712381f8 100644 --- a/scripts/bw-compatibility-test/network.sh +++ b/scripts/bw-compatibility-test/network.sh @@ -298,6 +298,24 @@ wait_for_active_chans() { echo "🟢 $node now has exactly $expected_channels active channels!" } +# collect_logs copies the lnd log file from each running container into a +# local ./logs directory. Call this before compose_down so logs are available +# for CI artifact upload even after the cluster is torn down. +function collect_logs() { + local log_dir="$DIR/logs" + mkdir -p "$log_dir" + + for node in alice bob charlie dave bob-pr dave-pr; do + if docker ps -a --format '{{.Names}}' | grep -q "^${node}$"; then + mkdir -p "$log_dir/$node" + docker cp "$node:/root/.lnd/logs/bitcoin/regtest/lnd.log" \ + "$log_dir/$node/lnd.log" 2>/dev/null || true + fi + done + + echo "📋 Logs collected in $log_dir" +} + # mine mines a number of blocks on the regtest network. If no # argument is provided, it defaults to 6 blocks. function mine() { diff --git a/scripts/bw-compatibility-test/test.sh b/scripts/bw-compatibility-test/test.sh index d8bb6660e..7b9f2f7bf 100755 --- a/scripts/bw-compatibility-test/test.sh +++ b/scripts/bw-compatibility-test/test.sh @@ -16,8 +16,9 @@ cd $DIR compose_up # Ensure that the cluster is shut down when the script exits -# regardless of success -trap compose_down EXIT +# 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