Skip to content

Commit d8abe5d

Browse files
committed
rfq: pass accepted price as a hint to the oracle during price check
When handling a quote request accept message, the peer-provided price must be validated against our price oracle. This commit passes the peer-provided price as a hint to the oracle, offering additional context to improve decision-making.
1 parent 519e499 commit d8abe5d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rfq/negotiator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,9 @@ func (n *Negotiator) HandleIncomingBuyAccept(msg rfqmsg.BuyAccept,
544544
// Ensure that the quote expiry time is within acceptable bounds.
545545
//
546546
// TODO(ffranr): Sanity check the buy accept quote expiry
547-
// timestamp given the expiry timestamp provided by the price
548-
// oracle.
547+
// timestamp given the expiry timestamp in our outgoing buy request.
548+
// The expiry timestamp in the outgoing request relates to the lifetime
549+
// of the lightning invoice.
549550
expiry := uint64(msg.AssetRate.Expiry.Unix())
550551
if !expiryWithinBounds(expiry, minAssetRatesExpiryLifetime) {
551552
// The expiry time is not within the acceptable bounds.
@@ -600,8 +601,7 @@ func (n *Negotiator) HandleIncomingBuyAccept(msg rfqmsg.BuyAccept,
600601
assetRate, err := n.queryAskFromPriceOracle(
601602
msg.Request.AssetSpecifier,
602603
fn.Some(msg.Request.AssetMaxAmt),
603-
fn.None[lnwire.MilliSatoshi](),
604-
fn.None[rfqmsg.AssetRate](),
604+
fn.None[lnwire.MilliSatoshi](), fn.Some(msg.AssetRate),
605605
)
606606
if err != nil {
607607
// The price oracle returned an error. We will return

0 commit comments

Comments
 (0)