@@ -1425,6 +1425,7 @@ func payInvoiceWithAssets(t *testing.T, payer, rfqPeer *HarnessNode,
14251425type  invoiceConfig  struct  {
14261426	errSubStr  string 
14271427	groupKey   []byte 
1428+ 	msats      lnwire.MilliSatoshi 
14281429}
14291430
14301431func  defaultInvoiceConfig () * invoiceConfig  {
@@ -1447,6 +1448,12 @@ func withInvGroupKey(groupKey []byte) invoiceOpt {
14471448	}
14481449}
14491450
1451+ func  withMsatAmount (amt  uint64 ) invoiceOpt  {
1452+ 	return  func (c  * invoiceConfig ) {
1453+ 		c .msats  =  lnwire .MilliSatoshi (amt )
1454+ 	}
1455+ }
1456+ 
14501457func  createAssetInvoice (t  * testing.T , dstRfqPeer , dst  * HarnessNode ,
14511458	assetAmount  uint64 , assetID  []byte ,
14521459	opts  ... invoiceOpt ) * lnrpc.AddInvoiceResponse  {
@@ -1475,7 +1482,8 @@ func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
14751482		InvoiceRequest : & lnrpc.Invoice {
14761483			Memo : fmt .Sprintf ("this is an asset invoice for " + 
14771484				"%d units" , assetAmount ),
1478- 			Expiry : timeoutSeconds ,
1485+ 			Expiry :    timeoutSeconds ,
1486+ 			ValueMsat : int64 (cfg .msats ),
14791487		},
14801488	}
14811489
@@ -1507,11 +1515,20 @@ func createAssetInvoice(t *testing.T, dstRfqPeer, dst *HarnessNode,
15071515
15081516	t .Logf ("Got quote for %v asset units per BTC" , rate )
15091517
1510- 	assetUnits  :=  rfqmath .NewBigIntFixedPoint (assetAmount , 0 )
1511- 	numMSats  :=  rfqmath .UnitsToMilliSatoshi (assetUnits , * rate )
1512- 	mSatPerUnit  :=  float64 (decodedInvoice .NumMsat ) /  float64 (assetAmount )
1518+ 	var  mSatPerUnit  float64 
1519+ 
1520+ 	if  cfg .msats  >  0  {
1521+ 		require .EqualValues (t , decodedInvoice .NumMsat , cfg .msats )
1522+ 		units  :=  rfqmath .MilliSatoshiToUnits (cfg .msats , * rate )
15131523
1514- 	require .EqualValues (t , numMSats , decodedInvoice .NumMsat )
1524+ 		mSatPerUnit  =  float64 (cfg .msats ) /  float64 (units .ToUint64 ())
1525+ 	} else  {
1526+ 		assetUnits  :=  rfqmath .NewBigIntFixedPoint (assetAmount , 0 )
1527+ 		numMSats  :=  rfqmath .UnitsToMilliSatoshi (assetUnits , * rate )
1528+ 		mSatPerUnit  =  float64 (decodedInvoice .NumMsat ) /  float64 (assetAmount )
1529+ 
1530+ 		require .EqualValues (t , numMSats , decodedInvoice .NumMsat )
1531+ 	}
15151532
15161533	t .Logf ("Got quote for %d mSats at %3f msat/unit from peer %x with " + 
15171534		"SCID %d" , decodedInvoice .NumMsat , mSatPerUnit ,
0 commit comments