@@ -726,6 +726,12 @@ func sendAssetKeySendPayment(t *testing.T, src, dst *HarnessNode, amt uint64,
726726		opt (cfg )
727727	}
728728
729+ 	// Nullify assetID if group key is set. RPC methods won't accept both so 
730+ 	// let's prioritize the group key if set. 
731+ 	if  len (cfg .groupKey ) >  0  {
732+ 		assetID  =  []byte {}
733+ 	}
734+ 
729735	ctxb  :=  context .Background ()
730736	ctxt , cancel  :=  context .WithTimeout (ctxb , defaultTimeout )
731737	defer  cancel ()
@@ -1013,6 +1019,12 @@ func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode,
10131019		opt (cfg )
10141020	}
10151021
1022+ 	// Nullify assetID if group key is set. RPC methods won't accept both so 
1023+ 	// let's prioritize the group key if set. 
1024+ 	if  len (cfg .groupKey ) >  0  {
1025+ 		assetID  =  []byte {}
1026+ 	}
1027+ 
10161028	ctxb  :=  context .Background ()
10171029	ctxt , cancel  :=  context .WithTimeout (ctxb , defaultTimeout )
10181030	defer  cancel ()
@@ -1138,6 +1150,12 @@ func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
11381150		opt (cfg )
11391151	}
11401152
1153+ 	// Nullify assetID if group key is set. RPC methods won't accept both so 
1154+ 	// let's prioritize the group key if set. 
1155+ 	if  len (cfg .groupKey ) >  0  {
1156+ 		assetID  =  []byte {}
1157+ 	}
1158+ 
11411159	ctxb  :=  context .Background ()
11421160	ctxt , cancel  :=  context .WithTimeout (ctxb , defaultTimeout )
11431161	defer  cancel ()
@@ -1218,12 +1236,12 @@ func assertInvoiceHtlcAssets(t *testing.T, node *HarnessNode,
12181236
12191237	var  targetID  string 
12201238	switch  {
1221- 	case  len (assetID ) >  0 :
1222- 		targetID  =  hex .EncodeToString (assetID )
1223- 
12241239	case  len (groupID ) >  0 :
12251240		groupHash  :=  sha256 .Sum256 (groupID )
12261241		targetID  =  hex .EncodeToString (groupHash [:])
1242+ 
1243+ 	case  len (assetID ) >  0 :
1244+ 		targetID  =  hex .EncodeToString (assetID )
12271245	}
12281246
12291247	var  totalAssetAmount  uint64 
@@ -1274,12 +1292,12 @@ func assertPaymentHtlcAssets(t *testing.T, node *HarnessNode, payHash []byte,
12741292
12751293	var  targetID  string 
12761294	switch  {
1277- 	case  len (assetID ) >  0 :
1278- 		targetID  =  hex .EncodeToString (assetID )
1279- 
12801295	case  len (groupID ) >  0 :
12811296		groupHash  :=  sha256 .Sum256 (groupID )
12821297		targetID  =  hex .EncodeToString (groupHash [:])
1298+ 
1299+ 	case  len (assetID ) >  0 :
1300+ 		targetID  =  hex .EncodeToString (assetID )
12831301	}
12841302
12851303	var  totalAssetAmount  uint64 
@@ -1310,7 +1328,19 @@ type assetHodlInvoice struct {
13101328}
13111329
13121330func  createAssetHodlInvoice (t  * testing.T , dstRfqPeer , dst  * HarnessNode ,
1313- 	assetAmount  uint64 , assetID  []byte ) assetHodlInvoice  {
1331+ 	assetAmount  uint64 , assetID  []byte ,
1332+ 	opts  ... invoiceOpt ) assetHodlInvoice  {
1333+ 
1334+ 	cfg  :=  defaultInvoiceConfig ()
1335+ 	for  _ , opt  :=  range  opts  {
1336+ 		opt (cfg )
1337+ 	}
1338+ 
1339+ 	// Nullify assetID if group key is set. RPC methods won't accept both so 
1340+ 	// let's prioritize the group key if set. 
1341+ 	if  len (cfg .groupKey ) >  0  {
1342+ 		assetID  =  []byte {}
1343+ 	}
13141344
13151345	ctxb  :=  context .Background ()
13161346	ctxt , cancel  :=  context .WithTimeout (ctxb , defaultTimeout )
@@ -1334,6 +1364,7 @@ func createAssetHodlInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
13341364
13351365	resp , err  :=  dstTapd .AddInvoice (ctxt , & tchrpc.AddInvoiceRequest {
13361366		AssetId :     assetID ,
1367+ 		GroupKey :    cfg .groupKey ,
13371368		AssetAmount : assetAmount ,
13381369		PeerPubkey :  dstRfqPeer .PubKey [:],
13391370		InvoiceRequest : & lnrpc.Invoice {
@@ -1372,6 +1403,22 @@ func createAssetHodlInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
13721403	}
13731404}
13741405
1406+ // addGroupModeOpt may add a group key option to the opts array, if the group 
1407+ // mode boolean is true. 
1408+ func  addGroupModeOpt (opts  * []payOpt , groupMode  bool , groupID  []byte ) {
1409+ 	if  groupMode  {
1410+ 		* opts  =  append (* opts , withGroupKey (groupID ))
1411+ 	}
1412+ }
1413+ 
1414+ // addGroupModeInvOpt may add a group key option to the opts array, if the group 
1415+ // mode boolean is true. 
1416+ func  addGroupModeInvOpt (opts  * []invoiceOpt , groupMode  bool , groupID  []byte ) {
1417+ 	if  groupMode  {
1418+ 		* opts  =  append (* opts , withInvGroupKey (groupID ))
1419+ 	}
1420+ }
1421+ 
13751422func  waitForSendEvent (t  * testing.T ,
13761423	sendEvents  taprpc.TaprootAssets_SubscribeSendEventsClient ,
13771424	expectedState  tapfreighter.SendState ) {
0 commit comments