Skip to content

Commit f25e447

Browse files
authored
Merge pull request #9445 from yyforyongyu/itest-flake
itest: fix flake in `testAnchorThirdPartySpend`
2 parents 1ed76af + bc8c164 commit f25e447

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

itest/list_exclude_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ var excludedTestsWindows = []string{
3939
"multihop-htlc aggregation simple taproot",
4040
"multihop-htlc aggregation simple taproot zero conf",
4141

42-
"channel force closure anchor",
43-
"channel force closure simple taproot",
42+
"channel force close-anchor",
43+
"channel force close-simple taproot",
4444
"channel backup restore force close",
4545
"wipe forwarding packages",
4646

itest/list_on_test.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,6 @@ var allTestCases = []*lntest.TestCase{
205205
Name: "channel unsettled balance",
206206
TestFunc: testChannelUnsettledBalance,
207207
},
208-
{
209-
Name: "channel force closure anchor",
210-
TestFunc: testChannelForceClosureAnchor,
211-
},
212-
{
213-
Name: "channel force closure simple taproot",
214-
TestFunc: testChannelForceClosureSimpleTaproot,
215-
},
216-
{
217-
Name: "failing channel",
218-
TestFunc: testFailingChannel,
219-
},
220208
{
221209
Name: "chain kit",
222210
TestFunc: testChainKit,
@@ -736,6 +724,9 @@ func init() {
736724
allTestCases = appendPrefixed(
737725
"send to route", allTestCases, sendToRouteTestCases,
738726
)
727+
allTestCases = appendPrefixed(
728+
"channel force close", allTestCases, channelForceCloseTestCases,
729+
)
739730

740731
// Prepare the test cases for windows to exclude some of the flaky
741732
// ones.

itest/lnd_channel_force_close_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ import (
1818
"github.com/stretchr/testify/require"
1919
)
2020

21+
var channelForceCloseTestCases = []*lntest.TestCase{
22+
{
23+
Name: "anchor",
24+
TestFunc: testChannelForceClosureAnchor,
25+
},
26+
{
27+
Name: "simple taproot",
28+
TestFunc: testChannelForceClosureSimpleTaproot,
29+
},
30+
{
31+
Name: "wrong preimage",
32+
TestFunc: testFailingChannel,
33+
},
34+
}
35+
2136
const pushAmt = btcutil.Amount(5e5)
2237

2338
// testChannelForceClosureAnchor runs `runChannelForceClosureTest` with anchor

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)