Skip to content

Commit 5c10225

Browse files
committed
itest: fix no longer needed workarounds
With lnd 0.19 a lot of sweeper and timing related issues were fixed with the whole blockbeat synchronization. This also changes a couple of assumptions around when a block needs to be mined, so we need to adjust our itests to that.
1 parent cd9c825 commit 5c10225

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

itest/assets_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,9 @@ func locateAssetTransfers(t *testing.T, tapdClient *tapClient,
334334
tapdClient.node.Name(), err)
335335
}
336336
if len(forceCloseTransfer.Transfers) != 1 {
337-
return fmt.Errorf("%v is missing force close "+
338-
"transfer", tapdClient.node.Name())
337+
return fmt.Errorf("%v is expecting %d transfers, has "+
338+
"%d", tapdClient.node.Name(), 1,
339+
len(forceCloseTransfer.Transfers))
339340
}
340341

341342
transfer = forceCloseTransfer.Transfers[0]

itest/litd_custom_channels_test.go

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,15 +1382,9 @@ func testCustomChannelsForceClose(ctx context.Context, net *NetworkHarness,
13821382

13831383
t.Logf("Universe proofs located!")
13841384

1385-
time.Sleep(time.Second * 1)
1386-
1387-
// We'll mine one more block, which triggers the 1 CSV needed for Dave
1388-
// to sweep his output.
1389-
mineBlocks(t, net, 1, 0)
1390-
13911385
// We should also have a new sweep transaction in the mempool.
13921386
daveSweepTxid, err := waitForNTxsInMempool(
1393-
net.Miner.Client, 1, time.Second*5,
1387+
net.Miner.Client, 1, shortTimeout,
13941388
)
13951389
require.NoError(t.t, err)
13961390

@@ -1412,11 +1406,11 @@ func testCustomChannelsForceClose(ctx context.Context, net *NetworkHarness,
14121406

14131407
// Next, we'll mine three additional blocks to trigger the CSV delay
14141408
// for Charlie.
1415-
mineBlocks(t, net, 3, 0)
1409+
mineBlocks(t, net, 4, 0)
14161410

14171411
// We expect that Charlie's sweep transaction has been broadcast.
14181412
charlieSweepTxid, err := waitForNTxsInMempool(
1419-
net.Miner.Client, 1, time.Second*5,
1413+
net.Miner.Client, 1, shortTimeout,
14201414
)
14211415
require.NoError(t.t, err)
14221416

@@ -1780,15 +1774,17 @@ func testCustomChannelsLiquidityEdgeCases(ctx context.Context,
17801774
connectAllNodes(t.t, net, nodes)
17811775
fundAllNodes(t.t, net, nodes)
17821776

1783-
// Create the normal channel between Dave and Erin.
1777+
// Create the normal channel between Dave and Erin. We don't clean up
1778+
// this channel because we expect there to be in-flight HTLCs due to
1779+
// some of the edge cases we're testing. Waiting for those HTLCs to time
1780+
// out would take too long.
17841781
t.Logf("Opening normal channel between Dave and Erin...")
17851782
channelOp := openChannelAndAssert(
17861783
t, net, dave, erin, lntest.OpenChannelParams{
17871784
Amt: 10_000_000,
17881785
SatPerVByte: 5,
17891786
},
17901787
)
1791-
defer closeChannelAndAssert(t, net, dave, channelOp, true)
17921788

17931789
// This is the only public channel, we need everyone to be aware of it.
17941790
assertChannelKnown(t.t, charlie, channelOp)
@@ -2235,7 +2231,7 @@ func testCustomChannelsStrictForwarding(ctx context.Context,
22352231
SatPerVByte: 5,
22362232
},
22372233
)
2238-
defer closeChannelAndAssert(t, net, dave, channelOp, true)
2234+
defer closeChannelAndAssert(t, net, dave, channelOp, false)
22392235

22402236
// This is the only public channel, we need everyone to be aware of it.
22412237
assertChannelKnown(t.t, charlie, channelOp)
@@ -2315,11 +2311,9 @@ func testCustomChannelsStrictForwarding(ctx context.Context,
23152311
// Erin pays Dave with enough satoshis, but Charlie will not settle as
23162312
// he expects assets.
23172313
hops := [][]byte{dave.PubKey[:]}
2318-
payInvoiceWithSatoshiLastHop(
2319-
t.t, erin, assetInvoice, hops, withFailure(
2320-
lnrpc.Payment_FAILED, 0,
2321-
),
2322-
)
2314+
payInvoiceWithSatoshiLastHop(t.t, erin, assetInvoice, hops, withFailure(
2315+
lnrpc.Payment_FAILED, 0,
2316+
))
23232317

23242318
// Make sure the invoice hasn't been settled and there's no HTLC on the
23252319
// channel between Erin and Dave.
@@ -3326,9 +3320,6 @@ func runCustomChannelsHtlcForceClose(ctx context.Context, t *harnessTest,
33263320
walletrpc.WitnessType_TAPROOT_HTLC_ACCEPTED_REMOTE_SUCCESS,
33273321
)
33283322

3329-
// We'll mine an empty block to get the sweeper to tick.
3330-
mineBlocks(t, net, 1, 0)
3331-
33323323
bobSweepTx1, err := waitForNTxsInMempool(
33333324
net.Miner.Client, 1, shortTimeout,
33343325
)
@@ -3523,9 +3514,6 @@ func runCustomChannelsHtlcForceClose(ctx context.Context, t *harnessTest,
35233514
walletrpc.WitnessType_TAPROOT_HTLC_OFFERED_REMOTE_TIMEOUT,
35243515
)
35253516

3526-
// We'll mine an extra block to trigger the sweeper.
3527-
mineBlocks(t, net, 1, 0)
3528-
35293517
t.Logf("Confirming initial HTLC timeout txns")
35303518

35313519
// Finally, we'll mine a single block to confirm them.

0 commit comments

Comments
 (0)