Skip to content

Commit e0fe977

Browse files
committed
itest: test use of asset ID or group key flags
1 parent 142e0e2 commit e0fe977

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

itest/assets_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,16 @@ func sendAssetKeySendPayment(t *testing.T, src, dst *HarnessNode, amt uint64,
10611061
stream, err := srcTapd.SendPayment(ctxt, request)
10621062
require.NoError(t, err)
10631063

1064+
// If an error is returned by the RPC method (meaning the stream itself
1065+
// was established, no network or auth error), we expect the error to be
1066+
// returned on the first read on the stream.
1067+
if cfg.errSubStr != "" {
1068+
_, err := stream.Recv()
1069+
require.ErrorContains(t, err, cfg.errSubStr)
1070+
1071+
return
1072+
}
1073+
10641074
result, err := getAssetPaymentResult(stream, false)
10651075
require.NoError(t, err)
10661076
if result.Status == lnrpc.Payment_FAILED {

itest/litd_custom_channels_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,31 @@ func testCustomChannelsGroupTranchesForceClose(ctx context.Context,
13021302
}
13031303
logBalanceGroup(t.t, nodes, groupIDs, "after keysend Erin->Fabia")
13041304

1305+
// We also assert that in a grouped channel with multiple grouped asset
1306+
// UTXOs we get a proper error if we try to do payments or create
1307+
// invoices while using a single asset ID.
1308+
sendAssetKeySendPayment(
1309+
t.t, erin, fabia, keySendAmount, assetID1, fn.None[int64](),
1310+
withPayErrSubStr(
1311+
"make sure to use group key for grouped asset channels",
1312+
),
1313+
)
1314+
createAssetInvoice(
1315+
t.t, charlie, dave, 100, assetID1, withInvoiceErrSubStr(
1316+
"make sure to use group key for grouped asset channels",
1317+
),
1318+
)
1319+
invoiceResp := createAssetInvoice(
1320+
t.t, charlie, dave, keySendAmount, nil,
1321+
withInvGroupKey(groupKey),
1322+
)
1323+
payInvoiceWithAssets(
1324+
t.t, charlie, dave, invoiceResp.PaymentRequest, assetID1,
1325+
withPayErrSubStr(
1326+
"make sure to use group key for grouped asset channels",
1327+
),
1328+
)
1329+
13051330
// ------------
13061331
// Test case 3: Co-op close the channel between Charlie and Dave.
13071332
// ------------

0 commit comments

Comments
 (0)