Skip to content

Commit 2f47d5e

Browse files
committed
rfq: remove unused arg from methods query*FromPriceOracle
This commit removes the `peer` argument from the methods queryBidFromPriceOracle and queryAskFromPriceOracle
1 parent 223b5ea commit 2f47d5e

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

rfq/negotiator.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/lightninglabs/taproot-assets/rfqmsg"
1313
"github.com/lightningnetwork/lnd/lnutils"
1414
"github.com/lightningnetwork/lnd/lnwire"
15-
"github.com/lightningnetwork/lnd/routing/route"
1615
)
1716

1817
const (
@@ -105,8 +104,8 @@ func NewNegotiator(cfg NegotiatorCfg) (*Negotiator, error) {
105104

106105
// queryBidFromPriceOracle queries the price oracle for a bid price. It returns
107106
// an appropriate outgoing response message which should be sent to the peer.
108-
func (n *Negotiator) queryBidFromPriceOracle(peer route.Vertex,
109-
assetSpecifier asset.Specifier, assetMaxAmt fn.Option[uint64],
107+
func (n *Negotiator) queryBidFromPriceOracle(assetSpecifier asset.Specifier,
108+
assetMaxAmt fn.Option[uint64],
110109
paymentMaxAmt fn.Option[lnwire.MilliSatoshi],
111110
assetRateHint fn.Option[rfqmsg.AssetRate]) (*rfqmsg.AssetRate, error) {
112111

@@ -178,7 +177,7 @@ func (n *Negotiator) HandleOutgoingBuyOrder(buyOrder BuyOrder) error {
178177

179178
// Query the price oracle for a bid price.
180179
assetRate, err := n.queryBidFromPriceOracle(
181-
peer, buyOrder.AssetSpecifier,
180+
buyOrder.AssetSpecifier,
182181
fn.Some(buyOrder.AssetMaxAmt),
183182
fn.None[lnwire.MilliSatoshi](),
184183
fn.None[rfqmsg.AssetRate](),
@@ -227,8 +226,8 @@ func (n *Negotiator) HandleOutgoingBuyOrder(buyOrder BuyOrder) error {
227226
// queryAskFromPriceOracle queries the price oracle for an asking price. It
228227
// returns an appropriate outgoing response message which should be sent to the
229228
// peer.
230-
func (n *Negotiator) queryAskFromPriceOracle(peer *route.Vertex,
231-
assetSpecifier asset.Specifier, assetMaxAmt fn.Option[uint64],
229+
func (n *Negotiator) queryAskFromPriceOracle(assetSpecifier asset.Specifier,
230+
assetMaxAmt fn.Option[uint64],
232231
paymentMaxAmt fn.Option[lnwire.MilliSatoshi],
233232
assetRateHint fn.Option[rfqmsg.AssetRate]) (*rfqmsg.AssetRate, error) {
234233

@@ -326,7 +325,7 @@ func (n *Negotiator) HandleIncomingBuyRequest(
326325

327326
// Query the price oracle for an asking price.
328327
assetRate, err := n.queryAskFromPriceOracle(
329-
nil, request.AssetSpecifier,
328+
request.AssetSpecifier,
330329
fn.Some(request.AssetMaxAmt),
331330
fn.None[lnwire.MilliSatoshi](),
332331
request.AssetRateHint,
@@ -426,9 +425,8 @@ func (n *Negotiator) HandleIncomingSellRequest(
426425
// are willing to pay for the asset that our peer is trying to
427426
// sell to us.
428427
assetRate, err := n.queryBidFromPriceOracle(
429-
request.Peer, request.AssetSpecifier,
430-
fn.None[uint64](), fn.Some(request.PaymentMaxAmt),
431-
request.AssetRateHint,
428+
request.AssetSpecifier, fn.None[uint64](),
429+
fn.Some(request.PaymentMaxAmt), request.AssetRateHint,
432430
)
433431
if err != nil {
434432
// Send a reject message to the peer.
@@ -484,7 +482,7 @@ func (n *Negotiator) HandleOutgoingSellOrder(order SellOrder) {
484482
if n.cfg.PriceOracle != nil && order.AssetSpecifier.IsSome() {
485483
// Query the price oracle for an asking price.
486484
assetRate, err := n.queryAskFromPriceOracle(
487-
&peer, order.AssetSpecifier,
485+
order.AssetSpecifier,
488486
fn.None[uint64](),
489487
fn.Some(order.PaymentMaxAmt),
490488
fn.None[rfqmsg.AssetRate](),
@@ -599,7 +597,7 @@ func (n *Negotiator) HandleIncomingBuyAccept(msg rfqmsg.BuyAccept,
599597
// for an ask price. We will then compare the ask price returned
600598
// by the price oracle with the ask price provided by the peer.
601599
assetRate, err := n.queryAskFromPriceOracle(
602-
&msg.Peer, msg.Request.AssetSpecifier,
600+
msg.Request.AssetSpecifier,
603601
fn.Some(msg.Request.AssetMaxAmt),
604602
fn.None[lnwire.MilliSatoshi](),
605603
fn.None[rfqmsg.AssetRate](),
@@ -725,8 +723,7 @@ func (n *Negotiator) HandleIncomingSellAccept(msg rfqmsg.SellAccept,
725723
// for a bid price. We will then compare the bid price returned
726724
// by the price oracle with the bid price provided by the peer.
727725
assetRate, err := n.queryBidFromPriceOracle(
728-
msg.Peer, msg.Request.AssetSpecifier,
729-
fn.None[uint64](),
726+
msg.Request.AssetSpecifier, fn.None[uint64](),
730727
fn.Some(msg.Request.PaymentMaxAmt),
731728
msg.Request.AssetRateHint,
732729
)

0 commit comments

Comments
 (0)