From 7b77462ddf9bdb5faaebcdfd3042b97ecc8bff26 Mon Sep 17 00:00:00 2001 From: archipelago Date: Thu, 9 Jul 2026 17:05:42 -0400 Subject: [PATCH] fix(tests): lnd.newaddress settle window for the post-cascade unlock race MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gate test 24 probed lnd.newaddress moments after the bitcoin bounce cascade-restarted lnd; the auto-unlocker was still retrying against a starting gRPC, so the probe saw LND_WALLET_LOCKED on a node that unlocks itself seconds later (verified on .228 — same request succeeds post-run). Treat WALLET_LOCKED as settling with a bounded 120s retry, mirroring the e21f3baf settle window for tests 123/124; every other error still fails fast, and a genuinely stuck-locked wallet still fails after the window. Co-Authored-By: Claude Fable 5 --- tests/lifecycle/bats/bitcoin-receive.bats | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/lifecycle/bats/bitcoin-receive.bats b/tests/lifecycle/bats/bitcoin-receive.bats index 278cbb73..2949bdd6 100644 --- a/tests/lifecycle/bats/bitcoin-receive.bats +++ b/tests/lifecycle/bats/bitcoin-receive.bats @@ -71,12 +71,21 @@ _lnd_running() { @test "lnd.newaddress returns a bech32 address when lnd is running" { _lnd_running || skip "lnd not running" - run rpc_call lnd.newaddress - [ "$status" -eq 0 ] - - local err addr - err=$(echo "$output" | jq -r '.error.message // .error // empty') - addr=$(echo "$output" | jq -r '.result.address // empty') + # The bitcoin bounce in bitcoin-knots.bats cascade-restarts lnd (24fd97ed). + # After a restart lnd's gRPC comes up seconds before the auto-unlocker gets + # through (its UnlockWallet calls log "waiting to start" until then), so + # LND_WALLET_LOCKED inside that window is the node settling, not broken — + # retry up to 120s. Any other error, or a wallet still locked after the + # window, fails immediately below. + local deadline=$((SECONDS + 120)) err addr + while :; do + run rpc_call lnd.newaddress + [ "$status" -eq 0 ] + err=$(echo "$output" | jq -r '.error.message // .error // empty') + addr=$(echo "$output" | jq -r '.result.address // empty') + [[ "$err" == *LND_WALLET_LOCKED* && $SECONDS -lt $deadline ]] || break + sleep 10 + done # The whole point of the fix: a running lnd must hand back a real address. if [[ -n "$err" ]]; then