Skip to content

Commit e4b205c

Browse files
committed
itest: fix flake in testAnchorThirdPartySpend
When mining lots of blocks in the itest, the subsystems can be out of sync in terms of the best block height. We now assert the num of pending sweeps on Alice's node to give her more time to sync the blocks, essentially behaving like a `time.Sleep` as in reality, the blocks would never be generated this fast.
1 parent baa34b0 commit e4b205c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

itest/lnd_onchain_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,13 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
564564
//
565565
// TODO(yy): also check the restart behavior of Alice.
566566
const anchorCsv = 16
567-
ht.MineEmptyBlocks(anchorCsv - defaultCSV)
567+
blocks := anchorCsv - defaultCSV
568+
569+
// Mine empty blocks and check Alice still has the two pending sweeps.
570+
for i := 0; i < blocks; i++ {
571+
ht.MineEmptyBlocks(1)
572+
ht.AssertNumPendingSweeps(alice, 2)
573+
}
568574

569575
// Now that the channel has been closed, and Alice has an unconfirmed
570576
// transaction spending the output produced by her anchor sweep, we'll

0 commit comments

Comments
 (0)