Skip to content

Commit 098eff9

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 25e562a commit 098eff9

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

itest/litd_custom_channels_test.go

Lines changed: 41 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 (
@@ -1289,16 +1293,23 @@ func testCustomChannelsGroupTranchesForceClose(ctx context.Context,
12891293
// that transports assets from two tranches.
12901294
// ------------
12911295
const (
1292-
keySendAmount = 5000
1293-
numSends = 6
1294-
totalFirstSend = keySendAmount * numSends
1296+
keySendAmount = 5000
1297+
keySendSatAmount = 5000
1298+
numSends = 6
1299+
totalFirstSend = keySendAmount * numSends
12951300
)
12961301
for i := 0; i < numSends; i++ {
12971302
sendAssetKeySendPayment(
12981303
t.t, charlie, dave, keySendAmount, nil,
12991304
fn.None[int64](), withGroupKey(groupKey),
13001305
)
13011306
}
1307+
1308+
// With noop HTLCs implemented the sats balance of Dave will only
1309+
// increase up to the reserve amount. Let's make a direct non-asset
1310+
// keysend to make sure the sats balance is also enough.
1311+
sendKeySendPayment(t.t, charlie, dave, keySendSatAmount)
1312+
13021313
logBalanceGroup(t.t, nodes, groupIDs, "after keysend Charlie->Dave")
13031314

13041315
// ------------
@@ -1538,8 +1549,9 @@ func testCustomChannelsGroupTranchesHtlcForceClose(ctx context.Context,
15381549
// First, we'll send over some funds from Charlie to Dave, as we want
15391550
// Dave to be able to extend HTLCs in the other direction.
15401551
const (
1541-
numPayments = 10
1542-
keySendAmount = 2_500
1552+
numPayments = 10
1553+
keySendAmount = 2_500
1554+
keySendSatAmount = 5000
15431555
)
15441556
for i := 0; i < numPayments; i++ {
15451557
sendAssetKeySendPayment(
@@ -1548,6 +1560,11 @@ func testCustomChannelsGroupTranchesHtlcForceClose(ctx context.Context,
15481560
)
15491561
}
15501562

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

2099+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
2100+
20822101
// Charlie will be the breached party. We set --nolisten to ensure Dave
20832102
// won't be able to connect to him and trigger the channel protection
20842103
// logic automatically. We also can't have Charlie automatically
@@ -2295,6 +2314,8 @@ func testCustomChannelsLiquidityEdgeCasesCore(ctx context.Context,
22952314
fmt.Sprintf(node.ListenerFormat, charliePort),
22962315
))
22972316

2317+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
2318+
22982319
// The topology we are going for looks like the following:
22992320
//
23002321
// Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia
@@ -3227,6 +3248,8 @@ func testCustomChannelsStrictForwarding(ctx context.Context,
32273248
fmt.Sprintf(node.ListenerFormat, charliePort),
32283249
))
32293250

3251+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
3252+
32303253
// The topology we are going for looks like the following:
32313254
//
32323255
// Charlie --[assets]--> Dave --[sats]--> Erin --[assets]--> Fabia
@@ -4219,16 +4242,24 @@ func runCustomChannelsHtlcForceClose(ctx context.Context, t *harnessTest,
42194242
// First, we'll send over some funds from Alice to Bob, as we want Bob
42204243
// to be able to extend HTLCs in the other direction.
42214244
const (
4222-
numPayments = 10
4223-
keySendAmount = 2_500
4245+
numPayments = 10
4246+
keySendAssetAmount = 2_500
4247+
keySendSatAmount = 5_000
42244248
)
42254249
for i := 0; i < numPayments; i++ {
42264250
sendAssetKeySendPayment(
4227-
t.t, alice, bob, keySendAmount, assetID,
4251+
t.t, alice, bob, keySendAssetAmount, assetID,
42284252
fn.None[int64](),
42294253
)
42304254
}
42314255

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

4751+
litdArgs = append(litdArgs, litdArgNoopHTLCs...)
4752+
47204753
// Next, we'll make Alice and Bob, who will be the main nodes under
47214754
// test.
47224755
alice, err := net.NewNodeWithPort(

0 commit comments

Comments
 (0)