From cfa4341740910ace6efa1013f411b8428eb7404d Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 26 Feb 2025 03:39:05 +0800 Subject: [PATCH] routing: fix flake in `TestFilteredChainView/bitcoind_polling` --- routing/chainview/interface_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/routing/chainview/interface_test.go b/routing/chainview/interface_test.go index f4daf22b5..b8726a875 100644 --- a/routing/chainview/interface_test.go +++ b/routing/chainview/interface_test.go @@ -730,6 +730,20 @@ var interfaceImpls = []struct { chainConn, blockCache, ) + // When running in rpc polling mode, the `reorg` method + // in `BitcoindClient`'s `ntfnHandler` may be invoked to + // handle the last block received from the miner during + // bitcoind's startup. This behavior will cause a block + // disconnected and a block connected notifications to + // be sent to the channels. + // + // TODO(yy): unify the chain backend logic and put + // everything in `btcwallet/chain` instead. The only + // place we use this chain view is in `graph/builder`, + // in which we subscribe to `FilteredBlocks` and + // `DisconnectedBlocks`. + time.Sleep(1 * time.Second) + return chainView, nil }, },