Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d72a0d5
itest: fix spawning temp miner
yyforyongyu Oct 29, 2024
fdddd54
itest: fix flake for neutrino backend
yyforyongyu Oct 30, 2024
c3cee82
itest: flatten PSBT funding test cases
yyforyongyu Oct 30, 2024
6d1eb98
itest: fix and document flake in sweeping tests
yyforyongyu Oct 30, 2024
8e171ce
itest: remove loop in `wsTestCaseBiDirectionalSubscription`
yyforyongyu Oct 30, 2024
220c71d
itest: fix flake in `testRevokedCloseRetributionZeroValueRemoteOutput`
yyforyongyu Nov 2, 2024
9d79d8d
itest: fix flake in `testSwitchOfflineDelivery`
yyforyongyu Nov 3, 2024
b73fecc
itest+routing: fix flake in `runFeeEstimationTestCase`
yyforyongyu Nov 3, 2024
46ec0bc
itest: use `ht.CreateSimpleNetwork` whenever applicable
yyforyongyu Nov 3, 2024
dc1d0c7
itest: put mpp tests in one file
yyforyongyu Nov 4, 2024
1ba41fc
lntest+itest: remove `AssertNumActiveEdges`
yyforyongyu Nov 8, 2024
4d89b40
itest: fix flake in runPsbtChanFundingWithNodes
yyforyongyu Nov 10, 2024
cb47db2
itest: fix flake in `testPrivateUpdateAlias`
yyforyongyu Nov 16, 2024
eea6671
itest: fix flake in `update_pending_open_channels`
yyforyongyu Nov 16, 2024
da77c84
lntest: increase `rpcmaxwebsockets` for `btcd`
yyforyongyu Nov 20, 2024
76dab6a
itest: document details about MPP-related tests
yyforyongyu Nov 21, 2024
dadceec
itest+lntest: fix flake in MPP-related tests
yyforyongyu Nov 21, 2024
097239e
lntest: fix flakeness in `openChannelsForNodes`
yyforyongyu Nov 22, 2024
86365c2
itest: document a rare flake found in `macOS`
yyforyongyu Dec 4, 2024
55b40e2
itest: document a flake found in `SendToRoute`
yyforyongyu Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,6 @@ var allTestCases = []*lntest.TestCase{
Name: "open channel reorg test",
TestFunc: testOpenChannelAfterReorg,
},
{
Name: "psbt channel funding",
TestFunc: testPsbtChanFunding,
},
{
Name: "sign psbt",
TestFunc: testSignPsbt,
Expand Down Expand Up @@ -573,8 +569,12 @@ var allTestCases = []*lntest.TestCase{
TestFunc: testChannelUtxoSelection,
},
{
Name: "update pending open channels",
TestFunc: testUpdateOnPendingOpenChannels,
Name: "update pending open channels on funder side",
TestFunc: testUpdateOnFunderPendingOpenChannels,
},
{
Name: "update pending open channels on fundee side",
TestFunc: testUpdateOnFundeePendingOpenChannels,
},
{
Name: "blinded payment htlc re-forward",
Expand Down Expand Up @@ -694,4 +694,5 @@ func init() {
// Register subtests.
allTestCases = append(allTestCases, multiHopForceCloseTestCases...)
allTestCases = append(allTestCases, watchtowerTestCases...)
allTestCases = append(allTestCases, psbtFundingTestCases...)
}
47 changes: 7 additions & 40 deletions itest/lnd_amp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ func testSendPaymentAMPInvoiceCase(ht *lntest.HarnessTest,
req := &lnrpc.InvoiceSubscription{}
bobInvoiceSubscription := mts.bob.RPC.SubscribeInvoices(req)

const paymentAmt = btcutil.Amount(300000)

// Set up a network with three different paths Alice <-> Bob. Channel
// capacities are set such that the payment can only succeed if (at
// least) three paths are used.
Expand All @@ -59,15 +57,8 @@ func testSendPaymentAMPInvoiceCase(ht *lntest.HarnessTest,
// \ /
// \__ Dave ____/
//
mppReq := &mppOpenChannelRequest{
amtAliceCarol: 285000,
amtAliceDave: 155000,
amtCarolBob: 200000,
amtCarolEve: 155000,
amtDaveBob: 155000,
amtEveBob: 155000,
}
mts.openChannels(mppReq)
paymentAmt := mts.setupSendPaymentCase()

chanPointAliceDave := mts.channelPoints[1]
chanPointDaveBob := mts.channelPoints[4]

Expand Down Expand Up @@ -373,7 +364,6 @@ func testSendPaymentAMPInvoiceRepeat(ht *lntest.HarnessTest) {
// destination using SendPaymentV2.
func testSendPaymentAMP(ht *lntest.HarnessTest) {
mts := newMppTestScenario(ht)
const paymentAmt = btcutil.Amount(300000)

// Set up a network with three different paths Alice <-> Bob. Channel
// capacities are set such that the payment can only succeed if (at
Expand All @@ -385,15 +375,8 @@ func testSendPaymentAMP(ht *lntest.HarnessTest) {
// \ /
// \__ Dave ____/
//
mppReq := &mppOpenChannelRequest{
amtAliceCarol: 285000,
amtAliceDave: 155000,
amtCarolBob: 200000,
amtCarolEve: 155000,
amtDaveBob: 155000,
amtEveBob: 155000,
}
mts.openChannels(mppReq)
paymentAmt := mts.setupSendPaymentCase()

chanPointAliceDave := mts.channelPoints[1]

// Increase Dave's fee to make the test deterministic. Otherwise, it
Expand Down Expand Up @@ -497,12 +480,6 @@ func testSendPaymentAMP(ht *lntest.HarnessTest) {

func testSendToRouteAMP(ht *lntest.HarnessTest) {
mts := newMppTestScenario(ht)
const (
paymentAmt = btcutil.Amount(300000)
numShards = 3
shardAmt = paymentAmt / numShards
chanAmt = shardAmt * 3 / 2
)

// Subscribe to bob's invoices.
req := &lnrpc.InvoiceSubscription{}
Expand All @@ -515,20 +492,10 @@ func testSendToRouteAMP(ht *lntest.HarnessTest) {
// \ /
// \__ Dave ____/
//
mppReq := &mppOpenChannelRequest{
// Since the channel Alice-> Carol will have to carry two
// shards, we make it larger.
amtAliceCarol: chanAmt + shardAmt,
amtAliceDave: chanAmt,
amtCarolBob: chanAmt,
amtCarolEve: chanAmt,
amtDaveBob: chanAmt,
amtEveBob: chanAmt,
}
mts.openChannels(mppReq)
paymentAmt, shardAmt := mts.setupSendToRouteCase()

// We'll send shards along three routes from Alice.
sendRoutes := [numShards][]*node.HarnessNode{
sendRoutes := [][]*node.HarnessNode{
{mts.carol, mts.bob},
{mts.dave, mts.bob},
{mts.carol, mts.eve, mts.bob},
Expand Down Expand Up @@ -662,7 +629,7 @@ func testSendToRouteAMP(ht *lntest.HarnessTest) {

// Finally, assert that the proper set id is recorded for each htlc, and
// that the preimage hash pair is valid.
require.Equal(ht, numShards, len(rpcInvoice.Htlcs))
require.Equal(ht, 3, len(rpcInvoice.Htlcs))
for _, htlc := range rpcInvoice.Htlcs {
require.NotNil(ht, htlc.Amp)
require.Equal(ht, setID, htlc.Amp.SetId)
Expand Down
16 changes: 16 additions & 0 deletions itest/lnd_channel_force_close_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,22 @@ func runChannelForceClosureTest(ht *lntest.HarnessTest,
"sweep transaction not spending from commit")
}

// For neutrino backend, due to it has no mempool, we need to check the
// sweep tx has already been saved to db before restarting. This is due
// to the possible race,
// - the fee bumper returns a TxPublished event, which is received by
// the sweeper and the sweep tx is saved to db.
// - the sweeper receives a shutdown signal before it receives the
// above event.
//
// TODO(yy): fix the above race.
if ht.IsNeutrinoBackend() {
// Check that we can find the commitment sweep in our set of
// known sweeps, using the simple transaction id ListSweeps
// output.
ht.AssertSweepFound(alice, sweepingTXID.String(), false, 0)
}

// Restart Alice to ensure that she resumes watching the finalized
// commitment sweep txid.
ht.RestartNode(alice)
Expand Down
6 changes: 3 additions & 3 deletions itest/lnd_channel_graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,17 @@ func testUnannouncedChannels(ht *lntest.HarnessTest) {
ht.WaitForChannelOpenEvent(chanOpenUpdate)

// Alice should have 1 edge in her graph.
ht.AssertNumActiveEdges(alice, 1, true)
ht.AssertNumEdges(alice, 1, true)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the windows build have no problem with this call tho, why are we not catching this nil case ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah when running in windows the behavior is quite different, which is why we skip some tests for the window build in the final PR, that being said, we don't really know why windows has this issue, and we now have somewhat a giant TODO list for the windows build.


// Channels should not be announced yet, hence Alice should have no
// announced edges in her graph.
ht.AssertNumActiveEdges(alice, 0, false)
ht.AssertNumEdges(alice, 0, false)

// Mine 4 more blocks, and check that the channel is now announced.
ht.MineBlocks(4)

// Give the network a chance to learn that auth proof is confirmed.
ht.AssertNumActiveEdges(alice, 1, false)
ht.AssertNumEdges(alice, 1, false)
}

func testGraphTopologyNotifications(ht *lntest.HarnessTest) {
Expand Down
3 changes: 2 additions & 1 deletion itest/lnd_estimate_route_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
"github.com/lightningnetwork/lnd/lntest"
"github.com/lightningnetwork/lnd/lntest/node"
"github.com/lightningnetwork/lnd/lntest/wait"
"github.com/lightningnetwork/lnd/routing"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -376,7 +377,7 @@ func runFeeEstimationTestCase(ht *lntest.HarnessTest,
)
feeReq = &routerrpc.RouteFeeRequest{
PaymentRequest: payReqs[0],
Timeout: 10,
Timeout: uint32(wait.PaymentTimeout.Seconds()),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the flake here tho, we are just increasing the timeout to 60s ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah the previous 10s will cause the payment to time out, updated the commit msg

}
} else {
feeReq = &routerrpc.RouteFeeRequest{
Expand Down
34 changes: 8 additions & 26 deletions itest/lnd_experimental_endorsement.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
"github.com/lightningnetwork/lnd/lntest"
"github.com/lightningnetwork/lnd/lntest/node"
"github.com/lightningnetwork/lnd/lntest/rpc"
"github.com/lightningnetwork/lnd/lntest/wait"
"github.com/lightningnetwork/lnd/lntypes"
Expand All @@ -24,37 +25,18 @@ func testExperimentalEndorsement(ht *lntest.HarnessTest) {
// testEndorsement sets up a 5 hop network and tests propagation of
// experimental endorsement signals.
func testEndorsement(ht *lntest.HarnessTest, aliceEndorse bool) {
alice := ht.NewNodeWithCoins("Alice", nil)
bob := ht.NewNodeWithCoins("Bob", nil)
carol := ht.NewNode(
"carol", []string{"--protocol.no-experimental-endorsement"},
cfg := node.CfgAnchor
carolCfg := append(
[]string{"--protocol.no-experimental-endorsement"}, cfg...,
)
dave := ht.NewNode("dave", nil)
eve := ht.NewNode("eve", nil)
cfgs := [][]string{cfg, cfg, carolCfg, cfg, cfg}

ht.EnsureConnected(alice, bob)
ht.EnsureConnected(bob, carol)
ht.EnsureConnected(carol, dave)
ht.EnsureConnected(dave, eve)

ht.FundCoins(btcutil.SatoshiPerBitcoin, carol)
ht.FundCoins(btcutil.SatoshiPerBitcoin, dave)
// Open and wait for channels.
const chanAmt = btcutil.Amount(300000)
p := lntest.OpenChannelParams{Amt: chanAmt}
reqs := []*lntest.OpenChannelRequest{
{Local: alice, Remote: bob, Param: p},
{Local: bob, Remote: carol, Param: p},
{Local: carol, Remote: dave, Param: p},
{Local: dave, Remote: eve, Param: p},
}
resp := ht.OpenMultiChannelsAsync(reqs)
_, cpBC, cpCD, cpDE := resp[0], resp[1], resp[2], resp[3]

// Make sure Alice is aware of Bob=>Carol=>Dave=>Eve channels.
ht.AssertChannelInGraph(alice, cpBC)
ht.AssertChannelInGraph(alice, cpCD)
ht.AssertChannelInGraph(alice, cpDE)
_, nodes := ht.CreateSimpleNetwork(cfgs, p)
alice, bob, carol, dave, eve := nodes[0], nodes[1], nodes[2], nodes[3],
nodes[4]

bobIntercept, cancelBob := bob.RPC.HtlcInterceptor()
defer cancelBob()
Expand Down
Loading