Skip to content

Commit 01e9ea6

Browse files
committed
itest: fixes for custom channels NoOp HTLCs
We add a new litd argument that triggers the usage of NoOp HTLCs. We may not use that argument in itests where backwards compatibility is enabled, as currently this leads to a channel force-closure.
1 parent cc727b5 commit 01e9ea6

File tree

1 file changed

+45
-8
lines changed

1 file changed

+45
-8
lines changed

itest/litd_custom_channels_test.go

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ var (
105105
"8820600",
106106
"--taproot-assets.experimental.rfq.acceptpricedeviationppm=50000",
107107
}...)
108+
109+
litdArgNoopHTLCs = []string{
110+
"--taproot-assets.channel.noop-htlcs",
111+
}
108112
)
109113

110114
const (
@@ -1182,6 +1186,8 @@ func testCustomChannelsGroupTranchesForceClose(ctx context.Context,
11821186
lndArgs := slices.Clone(lndArgsTemplate)
11831187
litdArgs := slices.Clone(litdArgsTemplate)
11841188

1189+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
1190+
11851191
// We use Charlie as the proof courier. But in order for Charlie to also
11861192
// use itself, we need to define its port upfront.
11871193
charliePort := port.NextAvailablePort()
@@ -1289,16 +1295,23 @@ func testCustomChannelsGroupTranchesForceClose(ctx context.Context,
12891295
// that transports assets from two tranches.
12901296
// ------------
12911297
const (
1292-
keySendAmount = 5000
1293-
numSends = 6
1294-
totalFirstSend = keySendAmount * numSends
1298+
keySendAmount = 5000
1299+
keySendSatAmount = 5000
1300+
numSends = 6
1301+
totalFirstSend = keySendAmount * numSends
12951302
)
12961303
for i := 0; i < numSends; i++ {
12971304
sendAssetKeySendPayment(
12981305
t.t, charlie, dave, keySendAmount, nil,
12991306
fn.None[int64](), withGroupKey(groupKey),
13001307
)
13011308
}
1309+
1310+
// With noop HTLCs implemented the sats balance of Dave will only
1311+
// increase up to the reserve amount. Let's make a direct non-asset
1312+
// keysend to make sure the sats balance is also enough.
1313+
sendKeySendPayment(t.t, charlie, dave, keySendSatAmount)
1314+
13021315
logBalanceGroup(t.t, nodes, groupIDs, "after keysend Charlie->Dave")
13031316

13041317
// ------------
@@ -1538,8 +1551,9 @@ func testCustomChannelsGroupTranchesHtlcForceClose(ctx context.Context,
15381551
// First, we'll send over some funds from Charlie to Dave, as we want
15391552
// Dave to be able to extend HTLCs in the other direction.
15401553
const (
1541-
numPayments = 10
1542-
keySendAmount = 2_500
1554+
numPayments = 10
1555+
keySendAmount = 2_500
1556+
keySendSatAmount = 5000
15431557
)
15441558
for i := 0; i < numPayments; i++ {
15451559
sendAssetKeySendPayment(
@@ -1548,6 +1562,11 @@ func testCustomChannelsGroupTranchesHtlcForceClose(ctx context.Context,
15481562
)
15491563
}
15501564

1565+
// With noop HTLCs implemented the sats balance of Dave will only
1566+
// increase up to the reserve amount. Let's make a direct non-asset
1567+
// keysend to make sure the sats balance is also enough.
1568+
sendKeySendPayment(t.t, charlie, dave, keySendSatAmount)
1569+
15511570
// Now that both parties have some funds, we'll move onto the main test.
15521571
//
15531572
// We'll make 2 hodl invoice for each peer, so 4 total. From Charlie's
@@ -2079,6 +2098,8 @@ func testCustomChannelsBreach(ctx context.Context, net *NetworkHarness,
20792098
fmt.Sprintf(node.ListenerFormat, charliePort),
20802099
))
20812100

2101+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
2102+
20822103
// Charlie will be the breached party. We set --nolisten to ensure Dave
20832104
// won't be able to connect to him and trigger the channel protection
20842105
// logic automatically. We also can't have Charlie automatically
@@ -2295,6 +2316,8 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
22952316
fmt.Sprintf(node.ListenerFormat, charliePort),
22962317
))
22972318

2319+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
2320+
22982321
// The topology we are going for looks like the following:
22992322
//
23002323
// Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia
@@ -3227,6 +3250,8 @@ func testCustomChannelsStrictForwarding(ctx context.Context,
32273250
fmt.Sprintf(node.ListenerFormat, charliePort),
32283251
))
32293252

3253+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
3254+
32303255
// The topology we are going for looks like the following:
32313256
//
32323257
// Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia
@@ -4139,6 +4164,8 @@ func runCustomChannelsHtlcForceClose(ctx context.Context, t *harnessTest,
41394164
lndArgs := slices.Clone(lndArgsTemplate)
41404165
litdArgs := slices.Clone(litdArgsTemplate)
41414166

4167+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
4168+
41424169
// Zane will serve as our designated Universe node.
41434170
zane, err := net.NewNode(
41444171
t.t, "Zane", lndArgs, false, true, litdArgs...,
@@ -4219,16 +4246,24 @@ func runCustomChannelsHtlcForceClose(ctx context.Context, t *harnessTest,
42194246
// First, we'll send over some funds from Alice to Bob, as we want Bob
42204247
// to be able to extend HTLCs in the other direction.
42214248
const (
4222-
numPayments = 10
4223-
keySendAmount = 2_500
4249+
numPayments = 10
4250+
keySendAssetAmount = 2_500
4251+
keySendSatAmount = 5_000
42244252
)
42254253
for i := 0; i < numPayments; i++ {
42264254
sendAssetKeySendPayment(
4227-
t.t, alice, bob, keySendAmount, assetID,
4255+
t.t, alice, bob, keySendAssetAmount, assetID,
42284256
fn.None[int64](),
42294257
)
42304258
}
42314259

4260+
// With noop HTLCs implemented the sats balance of Bob will only
4261+
// increase up to the reserve amount. Let's make a direct non-asset
4262+
// keysend to make sure the sats balance is also enough.
4263+
sendKeySendPayment(t.t, alice, bob, keySendSatAmount)
4264+
4265+
logBalance(t.t, nodes, assetID, "after keysends to Bob")
4266+
42324267
// Now that both parties have some funds, we'll move onto the main test.
42334268
//
42344269
// We'll make 2 hodl invoice for each peer, so 4 total. From Alice's
@@ -4717,6 +4752,8 @@ func testCustomChannelsSelfPayment(ctx context.Context, net *NetworkHarness,
47174752
fmt.Sprintf(node.ListenerFormat, alicePort),
47184753
))
47194754

4755+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
4756+
47204757
// Next, we'll make Alice and Bob, who will be the main nodes under
47214758
// test.
47224759
alice, err := net.NewNodeWithPort(

0 commit comments

Comments
 (0)