@@ -6819,13 +6819,9 @@ func marshallRfqEvent(eventInterface fn.Event) (*rfqrpc.RfqEvent, error) {
68196819 }, nil
68206820
68216821 case * rfq.PeerAcceptedSellQuoteEvent :
6822- rpcAcceptedQuote , err := taprpc .MarshalAcceptedSellQuoteEvent (
6822+ rpcAcceptedQuote := taprpc .MarshalAcceptedSellQuoteEvent (
68236823 event ,
68246824 )
6825- if err != nil {
6826- return nil , fmt .Errorf ("error marshalling accepted " +
6827- "sell quote event: %w" , err )
6828- }
68296825
68306826 eventRpc := & rfqrpc.RfqEvent_PeerAcceptedSellQuote {
68316827 PeerAcceptedSellQuote : & rfqrpc.PeerAcceptedSellQuoteEvent {
@@ -7061,36 +7057,12 @@ func (r *rpcServer) SendPayment(req *tchrpc.SendPaymentRequest,
70617057 "accepted quote" )
70627058 }
70637059
7064- invoice , err := zpay32 .Decode (
7065- pReq .PaymentRequest , r .cfg .Lnd .ChainParams ,
7066- )
7067- if err != nil {
7068- return fmt .Errorf ("error decoding payment request: %w" ,
7069- err )
7070- }
7071-
7072- rate := quote .AssetRate .Rate
7073-
70747060 // Calculate the equivalent asset units for the given invoice
70757061 // amount based on the asset-to-BTC conversion rate.
7076- numAssetUnits := rfqmath .MilliSatoshiToUnits (
7077- * invoice .MilliSat , rate ,
7078- )
7079-
7080- sellOrder := & rfqrpc.PeerAcceptedSellQuote {
7081- Peer : quote .Peer .String (),
7082- Id : quote .ID [:],
7083- Scid : uint64 (quote .ID .Scid ()),
7084- BidAssetRate : & rfqrpc.FixedPoint {
7085- Coefficient : rate .Coefficient .String (),
7086- Scale : uint32 (rate .Scale ),
7087- },
7088- AssetAmount : numAssetUnits .ToUint64 (),
7089- Expiry : uint64 (quote .AssetRate .Expiry .Unix ()),
7090- }
7062+ sellOrder := taprpc .MarshalAcceptedSellQuote (* quote )
70917063
70927064 // Send out the information about the quote on the stream.
7093- err = stream .Send (& tchrpc.SendPaymentResponse {
7065+ err : = stream .Send (& tchrpc.SendPaymentResponse {
70947066 Result : & tchrpc.SendPaymentResponse_AcceptedSellOrder {
70957067 AcceptedSellOrder : sellOrder ,
70967068 },
@@ -7101,8 +7073,8 @@ func (r *rpcServer) SendPayment(req *tchrpc.SendPaymentRequest,
71017073 }
71027074
71037075 rpcsLog .Infof ("Using quote for %v asset units at %v asset/BTC " +
7104- "from peer %x with SCID %d" , numAssetUnits ,
7105- rate .String (), quote .Peer , quote .ID .Scid ())
7076+ "from peer %x with SCID %d" , sellOrder . AssetAmount ,
7077+ quote . AssetRate .String (), quote .Peer , quote .ID .Scid ())
71067078
71077079 htlc := rfqmsg .NewHtlc (nil , fn .Some (quote .ID ))
71087080
@@ -7243,15 +7215,9 @@ func (r *rpcServer) SendPayment(req *tchrpc.SendPaymentRequest,
72437215 err )
72447216 }
72457217
7246- // Calculate the equivalent asset units for the given invoice
7247- // amount based on the asset-to-BTC conversion rate.
7248- numAssetUnits := rfqmath .MilliSatoshiToUnits (
7249- * invoice .MilliSat , * assetRate ,
7250- )
7251-
72527218 rpcsLog .Infof ("Got quote for %v asset units at %v asset/BTC " +
7253- "from peer %x with SCID %d" , numAssetUnits , assetRate ,
7254- peerPubKey , acceptedQuote .Scid )
7219+ "from peer %x with SCID %d" , acceptedQuote . AssetAmount ,
7220+ assetRate , peerPubKey , acceptedQuote .Scid )
72557221
72567222 var rfqID rfqmsg.ID
72577223 copy (rfqID [:], acceptedQuote .Id )
0 commit comments