Skip to content

Commit e4a0bdb

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 5daf211 commit e4a0bdb

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
@@ -1279,16 +1279,23 @@ func testCustomChannelsGroupTranchesForceClose(ctx context.Context,
12791279
// that transports assets from two tranches.
12801280
// ------------
12811281
const (
1282-
keySendAmount = 5000
1283-
numSends = 6
1284-
totalFirstSend = keySendAmount * numSends
1282+
keySendAmount = 5000
1283+
keySendSatAmount = 5000
1284+
numSends = 6
1285+
totalFirstSend = keySendAmount * numSends
12851286
)
12861287
for i := 0; i < numSends; i++ {
12871288
sendAssetKeySendPayment(
12881289
t.t, charlie, dave, keySendAmount, nil,
12891290
fn.None[int64](), withGroupKey(groupKey),
12901291
)
12911292
}
1293+
1294+
// With noop HTLCs implemented the sats balance of Dave will only
1295+
// increase up to the reserve amount. Let's make a direct non-asset
1296+
// keysend to make sure the sats balance is also enough.
1297+
sendKeySendPayment(t.t, charlie, dave, keySendSatAmount)
1298+
12921299
logBalanceGroup(t.t, nodes, groupIDs, "after keysend Charlie->Dave")
12931300

12941301
// ------------
@@ -1528,8 +1535,9 @@ func testCustomChannelsGroupTranchesHtlcForceClose(ctx context.Context,
15281535
// First, we'll send over some funds from Charlie to Dave, as we want
15291536
// Dave to be able to extend HTLCs in the other direction.
15301537
const (
1531-
numPayments = 10
1532-
keySendAmount = 2_500
1538+
numPayments = 10
1539+
keySendAmount = 2_500
1540+
keySendSatAmount = 5000
15331541
)
15341542
for i := 0; i < numPayments; i++ {
15351543
sendAssetKeySendPayment(
@@ -1538,6 +1546,11 @@ func testCustomChannelsGroupTranchesHtlcForceClose(ctx context.Context,
15381546
)
15391547
}
15401548

1549+
// With noop HTLCs implemented the sats balance of Dave will only
1550+
// increase up to the reserve amount. Let's make a direct non-asset
1551+
// keysend to make sure the sats balance is also enough.
1552+
sendKeySendPayment(t.t, charlie, dave, keySendSatAmount)
1553+
15411554
// Now that both parties have some funds, we'll move onto the main test.
15421555
//
15431556
// We'll make 2 hodl invoice for each peer, so 4 total. From Charlie's
@@ -4040,16 +4053,24 @@ func runCustomChannelsHtlcForceClose(ctx context.Context, t *harnessTest,
40404053
// First, we'll send over some funds from Alice to Bob, as we want Bob
40414054
// to be able to extend HTLCs in the other direction.
40424055
const (
4043-
numPayments = 10
4044-
keySendAmount = 2_500
4056+
numPayments = 10
4057+
keySendAssetAmount = 2_500
4058+
keySendSatAmount = 5_000
40454059
)
40464060
for i := 0; i < numPayments; i++ {
40474061
sendAssetKeySendPayment(
4048-
t.t, alice, bob, keySendAmount, assetID,
4062+
t.t, alice, bob, keySendAssetAmount, assetID,
40494063
fn.None[int64](),
40504064
)
40514065
}
40524066

4067+
// With noop HTLCs implemented the sats balance of Bob will only
4068+
// increase up to the reserve amount. Let's make a direct non-asset
4069+
// keysend to make sure the sats balance is also enough.
4070+
sendKeySendPayment(t.t, alice, bob, keySendSatAmount)
4071+
4072+
logBalance(t.t, nodes, assetID, "after keysends to Bob")
4073+
40534074
// Now that both parties have some funds, we'll move onto the main test.
40544075
//
40554076
// We'll make 2 hodl invoice for each peer, so 4 total. From Alice's

0 commit comments

Comments
 (0)