lntest: make sure chain backend is synced to miner

We sometimes see `timeout waiting for UTXOs` error from bitcoind-related
itests due to the chain backend not synced to the miner. We now assert
it's synced before continue.
This commit is contained in:
yyforyongyu committed 2024-12-20 19:38:14 +08:00
1 parent 1dec926165
commit 7ab4081ffd
3 files changed
+15 -12

No files matched your search

+3 -3
View File
@@ -61,9 +61,9 @@ func (h *HarnessTest) WaitForBlockchainSync(hn *node.HarnessNode) {
// WaitForBlockchainSyncTo waits until the node is synced to bestBlock.
func (h *HarnessTest) WaitForBlockchainSyncTo(hn *node.HarnessNode,
bestBlock *wire.MsgBlock) {
bestBlock chainhash.Hash) {
bestBlockHash := bestBlock.BlockHash().String()
bestBlockHash := bestBlock.String()
err := wait.NoError(func() error {
resp := hn.RPC.GetInfo()
if resp.SyncedToChain {
@@ -1629,7 +1629,7 @@ func (h *HarnessTest) AssertActiveNodesSynced() {
// AssertActiveNodesSyncedTo asserts all active nodes have synced to the
// provided bestBlock.
func (h *HarnessTest) AssertActiveNodesSyncedTo(bestBlock *wire.MsgBlock) {
func (h *HarnessTest) AssertActiveNodesSyncedTo(bestBlock chainhash.Hash) {
for _, node := range h.manager.activeNodes {
h.WaitForBlockchainSyncTo(node, bestBlock)
}