@@ -7679,18 +7679,26 @@ func checkOverpayment(quote *rfqrpc.PeerAcceptedSellQuote,
7679
7679
func (r * rpcServer ) AddInvoice (ctx context.Context ,
7680
7680
req * tchrpc.AddInvoiceRequest ) (* tchrpc.AddInvoiceResponse , error ) {
7681
7681
7682
+ if len (req .AssetId ) > 0 && len (req .GroupKey ) > 0 {
7683
+ return nil , fmt .Errorf ("cannot set both asset id and group key" )
7684
+ }
7685
+
7682
7686
if req .InvoiceRequest == nil {
7683
7687
return nil , fmt .Errorf ("invoice request must be specified" )
7684
7688
}
7685
7689
iReq := req .InvoiceRequest
7686
7690
7687
- // Do some preliminary checks on the asset ID and make sure we have any
7688
- // balance for that asset.
7689
- if len (req .AssetId ) != sha256 .Size {
7690
- return nil , fmt .Errorf ("asset ID must be 32 bytes" )
7691
+ assetID , groupKey , err := parseAssetSpecifier (
7692
+ req .AssetId , "" , req .GroupKey , "" ,
7693
+ )
7694
+ if err != nil {
7695
+ return nil , err
7696
+ }
7697
+
7698
+ specifier , err := asset .NewExclusiveSpecifier (assetID , groupKey )
7699
+ if err != nil {
7700
+ return nil , err
7691
7701
}
7692
- var assetID asset.ID
7693
- copy (assetID [:], req .AssetId )
7694
7702
7695
7703
// The peer public key is optional if there is only a single asset
7696
7704
// channel.
@@ -7705,8 +7713,6 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
7705
7713
peerPubKey = & parsedKey
7706
7714
}
7707
7715
7708
- specifier := asset .NewSpecifierFromId (assetID )
7709
-
7710
7716
// We can now query the asset channels we have.
7711
7717
assetChan , err := r .rfqChannel (
7712
7718
ctx , specifier , peerPubKey , ReceiveIntention ,
@@ -7728,15 +7734,13 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
7728
7734
time .Duration (expirySeconds ) * time .Second ,
7729
7735
)
7730
7736
7737
+ rpcSpecifier := marshalAssetSpecifier (specifier )
7738
+
7731
7739
resp , err := r .AddAssetBuyOrder (ctx , & rfqrpc.AddAssetBuyOrderRequest {
7732
- AssetSpecifier : & rfqrpc.AssetSpecifier {
7733
- Id : & rfqrpc.AssetSpecifier_AssetId {
7734
- AssetId : assetID [:],
7735
- },
7736
- },
7737
- AssetMaxAmt : req .AssetAmount ,
7738
- Expiry : uint64 (expiryTimestamp .Unix ()),
7739
- PeerPubKey : peerPubKey [:],
7740
+ AssetSpecifier : & rpcSpecifier ,
7741
+ AssetMaxAmt : req .AssetAmount ,
7742
+ Expiry : uint64 (expiryTimestamp .Unix ()),
7743
+ PeerPubKey : peerPubKey [:],
7740
7744
TimeoutSeconds : uint32 (
7741
7745
rfq .DefaultTimeout .Seconds (),
7742
7746
),
0 commit comments