@@ -1420,6 +1420,7 @@ func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode,
14201420type  invoiceConfig  struct  {
14211421	errSubStr  string 
14221422	groupKey   []byte 
1423+ 	msats      lnwire.MilliSatoshi 
14231424}
14241425
14251426func  defaultInvoiceConfig () * invoiceConfig  {
@@ -1442,6 +1443,12 @@ func withInvGroupKey(groupKey []byte) invoiceOpt {
14421443	}
14431444}
14441445
1446+ func  withMsatAmount (amt  uint64 ) invoiceOpt  {
1447+ 	return  func (c  * invoiceConfig ) {
1448+ 		c .msats  =  lnwire .MilliSatoshi (amt )
1449+ 	}
1450+ }
1451+ 
14451452func  createAssetInvoice (t  * testing.T , dstRfqPeer , dst  * HarnessNode ,
14461453	assetAmount  uint64 , assetID  []byte ,
14471454	opts  ... invoiceOpt ) * lnrpc.AddInvoiceResponse  {
@@ -1470,7 +1477,8 @@ func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
14701477		InvoiceRequest : & lnrpc.Invoice {
14711478			Memo : fmt .Sprintf ("this is an asset invoice for " + 
14721479				"%d units" , assetAmount ),
1473- 			Expiry : timeoutSeconds ,
1480+ 			Expiry :    timeoutSeconds ,
1481+ 			ValueMsat : int64 (cfg .msats ),
14741482		},
14751483	}
14761484
@@ -1502,11 +1510,20 @@ func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
15021510
15031511	t .Logf ("Got quote for %v asset units per BTC" , rate )
15041512
1505- 	assetUnits  :=  rfqmath .NewBigIntFixedPoint (assetAmount , 0 )
1506- 	numMSats  :=  rfqmath .UnitsToMilliSatoshi (assetUnits , * rate )
1507- 	mSatPerUnit  :=  float64 (decodedInvoice .NumMsat ) /  float64 (assetAmount )
1513+ 	var  mSatPerUnit  float64 
1514+ 
1515+ 	if  cfg .msats  >  0  {
1516+ 		require .EqualValues (t , decodedInvoice .NumMsat , cfg .msats )
1517+ 		units  :=  rfqmath .MilliSatoshiToUnits (cfg .msats , * rate )
15081518
1509- 	require .EqualValues (t , numMSats , decodedInvoice .NumMsat )
1519+ 		mSatPerUnit  =  float64 (cfg .msats ) /  float64 (units .ToUint64 ())
1520+ 	} else  {
1521+ 		assetUnits  :=  rfqmath .NewBigIntFixedPoint (assetAmount , 0 )
1522+ 		numMSats  :=  rfqmath .UnitsToMilliSatoshi (assetUnits , * rate )
1523+ 		mSatPerUnit  =  float64 (decodedInvoice .NumMsat ) /  float64 (assetAmount )
1524+ 
1525+ 		require .EqualValues (t , numMSats , decodedInvoice .NumMsat )
1526+ 	}
15101527
15111528	t .Logf ("Got quote for %d mSats at %3f msat/unit from peer %x with " + 
15121529		"SCID %d" , decodedInvoice .NumMsat , mSatPerUnit ,
0 commit comments