@@ -106,8 +106,9 @@ func NewNegotiator(cfg NegotiatorCfg) (*Negotiator, error) {
106106// queryBidFromPriceOracle queries the price oracle for a bid price. It returns
107107// an appropriate outgoing response message which should be sent to the peer.
108108func (n * Negotiator ) queryBidFromPriceOracle (peer route.Vertex ,
109- assetId * asset.ID , assetGroupKey * btcec.PublicKey ,
110- assetAmount uint64 ) (* rfqmath.BigIntFixedPoint , uint64 , error ) {
109+ assetId * asset.ID , assetGroupKey * btcec.PublicKey , assetAmount uint64 ,
110+ assetRateHint fn.Option [rfqmsg.AssetRate ]) (* rfqmath.BigIntFixedPoint ,
111+ uint64 , error ) {
111112
112113 // TODO(ffranr): Optionally accept a peer's proposed ask price as an
113114 // arg to this func and pass it to the price oracle. The price oracle
@@ -120,7 +121,7 @@ func (n *Negotiator) queryBidFromPriceOracle(peer route.Vertex,
120121 defer cancel ()
121122
122123 oracleResponse , err := n .cfg .PriceOracle .QueryBidPrice (
123- ctx , assetId , assetGroupKey , assetAmount ,
124+ ctx , assetId , assetGroupKey , assetAmount , assetRateHint ,
124125 )
125126 if err != nil {
126127 return nil , 0 , fmt .Errorf ("failed to query price oracle for " +
@@ -168,6 +169,7 @@ func (n *Negotiator) HandleOutgoingBuyOrder(buyOrder BuyOrder) error {
168169 rate , _ , err := n .queryBidFromPriceOracle (
169170 * buyOrder .Peer , buyOrder .AssetID ,
170171 buyOrder .AssetGroupKey , buyOrder .MinAssetAmount ,
172+ fn .None [rfqmsg.AssetRate ](),
171173 )
172174 if err != nil {
173175 // If we fail to query the price oracle for a
@@ -407,7 +409,7 @@ func (n *Negotiator) HandleIncomingSellRequest(
407409 // sell to us.
408410 assetRate , rateExpiry , err := n .queryBidFromPriceOracle (
409411 request .Peer , request .AssetID , request .AssetGroupKey ,
410- request .AssetAmount ,
412+ request .AssetAmount , request . AssetRateHint ,
411413 )
412414 if err != nil {
413415 // Send a reject message to the peer.
@@ -692,7 +694,7 @@ func (n *Negotiator) HandleIncomingSellAccept(msg rfqmsg.SellAccept,
692694 // by the price oracle with the bid price provided by the peer.
693695 assetRate , _ , err := n .queryBidFromPriceOracle (
694696 msg .Peer , msg .Request .AssetID , nil ,
695- msg .Request .AssetAmount ,
697+ msg .Request .AssetAmount , msg . Request . AssetRateHint ,
696698 )
697699 if err != nil {
698700 // The price oracle returned an error. We will return
0 commit comments