Skip to content

Commit 44fae26

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 44fae26

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

itest/litd_custom_channels_test.go

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,16 +1289,23 @@ func testCustomChannelsGroupTranchesForceClose(ctx context.Context,
12891289
// that transports assets from two tranches.
12901290
// ------------
12911291
const (
1292-
keySendAmount = 5000
1293-
numSends = 6
1294-
totalFirstSend = keySendAmount * numSends
1292+
keySendAmount = 5000
1293+
keySendSatAmount = 5000
1294+
numSends = 6
1295+
totalFirstSend = keySendAmount * numSends
12951296
)
12961297
for i := 0; i < numSends; i++ {
12971298
sendAssetKeySendPayment(
12981299
t.t, charlie, dave, keySendAmount, nil,
12991300
fn.None[int64](), withGroupKey(groupKey),
13001301
)
13011302
}
1303+
1304+
// With noop HTLCs implemented the sats balance of Dave will only
1305+
// increase up to the reserve amount. Let's make a direct non-asset
1306+
// keysend to make sure the sats balance is also enough.
1307+
sendKeySendPayment(t.t, charlie, dave, keySendSatAmount)
1308+
13021309
logBalanceGroup(t.t, nodes, groupIDs, "after keysend Charlie->Dave")
13031310

13041311
// ------------
@@ -1538,8 +1545,9 @@ func testCustomChannelsGroupTranchesHtlcForceClose(ctx context.Context,
15381545
// First, we'll send over some funds from Charlie to Dave, as we want
15391546
// Dave to be able to extend HTLCs in the other direction.
15401547
const (
1541-
numPayments = 10
1542-
keySendAmount = 2_500
1548+
numPayments = 10
1549+
keySendAmount = 2_500
1550+
keySendSatAmount = 5000
15431551
)
15441552
for i := 0; i < numPayments; i++ {
15451553
sendAssetKeySendPayment(
@@ -1548,6 +1556,11 @@ func testCustomChannelsGroupTranchesHtlcForceClose(ctx context.Context,
15481556
)
15491557
}
15501558

1559+
// With noop HTLCs implemented the sats balance of Dave will only
1560+
// increase up to the reserve amount. Let's make a direct non-asset
1561+
// keysend to make sure the sats balance is also enough.
1562+
sendKeySendPayment(t.t, charlie, dave, keySendSatAmount)
1563+
15511564
// Now that both parties have some funds, we'll move onto the main test.
15521565
//
15531566
// We'll make 2 hodl invoice for each peer, so 4 total. From Charlie's
@@ -4219,16 +4232,24 @@ func runCustomChannelsHtlcForceClose(ctx context.Context, t *harnessTest,
42194232
// First, we'll send over some funds from Alice to Bob, as we want Bob
42204233
// to be able to extend HTLCs in the other direction.
42214234
const (
4222-
numPayments = 10
4223-
keySendAmount = 2_500
4235+
numPayments = 10
4236+
keySendAssetAmount = 2_500
4237+
keySendSatAmount = 5_000
42244238
)
42254239
for i := 0; i < numPayments; i++ {
42264240
sendAssetKeySendPayment(
4227-
t.t, alice, bob, keySendAmount, assetID,
4241+
t.t, alice, bob, keySendAssetAmount, assetID,
42284242
fn.None[int64](),
42294243
)
42304244
}
42314245

4246+
// With noop HTLCs implemented the sats balance of Bob will only
4247+
// increase up to the reserve amount. Let's make a direct non-asset
4248+
// keysend to make sure the sats balance is also enough.
4249+
sendKeySendPayment(t.t, alice, bob, keySendSatAmount)
4250+
4251+
logBalance(t.t, nodes, assetID, "after keysends to Bob")
4252+
42324253
// Now that both parties have some funds, we'll move onto the main test.
42334254
//
42344255
// We'll make 2 hodl invoice for each peer, so 4 total. From Alice's

itest/litd_node.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,10 @@ func renameFile(fromFileName, toFileName string) {
652652
func (hn *HarnessNode) overrideFlagsAndBinary(backwardCompat map[string]string,
653653
binary string, args []LitArgOption) (string, []LitArgOption) {
654654

655+
noopArg := WithLitArg("taproot-assets.channel.noop-htlcs", "")
656+
655657
if backwardCompat == nil {
658+
args = append(args, noopArg)
656659
return binary, args
657660
}
658661

0 commit comments

Comments
 (0)