lnd/lnwallet/test
ziggie 3cf60bd474
lnwallet/test: fix flaky neutrino reorg sync timeout
waitForWalletSync used time.Tick inside the poll loop, leaking a new
goroutine on every iteration. Over 5 reorg cycles with ~300 polls each
this accumulated up to 1500 leaked goroutines, adding measurable system
load that made the 30s timeout too tight, especially when running against
a postgres backend where block-processing writes carry more overhead.

Fix the leak by using a single time.NewTicker (deferred Stop), and raise
the timeout to 2 minutes to give the neutrino P2P layer and the
address-manager transaction walk enough headroom under load.

Also improve the timeout error messages to identify which of the two
sync layers was stuck:
- Layer 1 (header/P2P): ChainIO.GetBestBlock height has not yet caught
  up to the miner tip — neutrino is still fetching headers.
- Layer 2 (transaction walk): heights matched but IsSynced() never
  returned true — the chain-sync notification or the address-manager
  DB write (undo+redo on reorg) did not complete in time.

Add a detailed doc comment to waitForWalletSync explaining the three
pipeline stages (header sync, compact-filter/block fetch, transaction
walk) and why each stage is relevant, so a future timeout can be
diagnosed from the error message alone.
2026-04-26 22:32:33 -03:00
..
bitcoind lnwallet/test: test against bitcoind-rpc-polling backend 2022-05-11 09:02:13 +02:00
btcd lnwallet/test: execute ifacet tests for each backend in parallel 2020-12-10 17:42:26 -08:00
neutrino lnwallet/test: execute ifacet tests for each backend in parallel 2020-12-10 17:42:26 -08:00
test_interface.go lnwallet/test: fix flaky neutrino reorg sync timeout 2026-04-26 22:32:33 -03:00