Skip to content

Commit

Permalink
Merge pull request lightningnetwork#9445 from yyforyongyu/itest-flake
Browse files Browse the repository at this point in the history
itest: fix flake in `testAnchorThirdPartySpend`
  • Loading branch information
guggero authored Jan 27, 2025
2 parents 1ed76af + bc8c164 commit f25e447
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions itest/list_exclude_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ var excludedTestsWindows = []string{
"multihop-htlc aggregation simple taproot",
"multihop-htlc aggregation simple taproot zero conf",

"channel force closure anchor",
"channel force closure simple taproot",
"channel force close-anchor",
"channel force close-simple taproot",
"channel backup restore force close",
"wipe forwarding packages",

Expand Down
15 changes: 3 additions & 12 deletions itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,6 @@ var allTestCases = []*lntest.TestCase{
Name: "channel unsettled balance",
TestFunc: testChannelUnsettledBalance,
},
{
Name: "channel force closure anchor",
TestFunc: testChannelForceClosureAnchor,
},
{
Name: "channel force closure simple taproot",
TestFunc: testChannelForceClosureSimpleTaproot,
},
{
Name: "failing channel",
TestFunc: testFailingChannel,
},
{
Name: "chain kit",
TestFunc: testChainKit,
Expand Down Expand Up @@ -736,6 +724,9 @@ func init() {
allTestCases = appendPrefixed(
"send to route", allTestCases, sendToRouteTestCases,
)
allTestCases = appendPrefixed(
"channel force close", allTestCases, channelForceCloseTestCases,
)

// Prepare the test cases for windows to exclude some of the flaky
// ones.
Expand Down
15 changes: 15 additions & 0 deletions itest/lnd_channel_force_close_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ import (
"github.com/stretchr/testify/require"
)

var channelForceCloseTestCases = []*lntest.TestCase{
{
Name: "anchor",
TestFunc: testChannelForceClosureAnchor,
},
{
Name: "simple taproot",
TestFunc: testChannelForceClosureSimpleTaproot,
},
{
Name: "wrong preimage",
TestFunc: testFailingChannel,
},
}

const pushAmt = btcutil.Amount(5e5)

// testChannelForceClosureAnchor runs `runChannelForceClosureTest` with anchor
Expand Down
8 changes: 7 additions & 1 deletion itest/lnd_onchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,13 @@ func testAnchorThirdPartySpend(ht *lntest.HarnessTest) {
//
// TODO(yy): also check the restart behavior of Alice.
const anchorCsv = 16
ht.MineEmptyBlocks(anchorCsv - defaultCSV)
blocks := anchorCsv - defaultCSV

// Mine empty blocks and check Alice still has the two pending sweeps.
for i := 0; i < blocks; i++ {
ht.MineEmptyBlocks(1)
ht.AssertNumPendingSweeps(alice, 2)
}

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

0 comments on commit f25e447

Please sign in to comment.