Skip to content

Commit 399a498

Browse files
committed
itest: add sats keysends to cover missing noop_htlc anchors
Many of our itest cases would rely on making multiple asset keysends to initialize the state for our test case. This would include the expectation that the receiver would receive enough sats to be able to pay back the sender. With noop HTLCs the sender only sends the sats to the receiver iff they are currently below reserve. We add some direct sats keysends to give the receiver some sats balance to be able to support sending back asset HTLCs.
1 parent 683569d commit 399a498

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-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

0 commit comments

Comments
 (0)