Skip to content

Commit

Permalink
rpcserver: skip rfq negotiation on manual SendPayment rfq
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeTsagk committed Nov 28, 2024
1 parent 4eb7e88 commit f2557d3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7034,6 +7034,27 @@ func (r *rpcServer) SendPayment(req *tchrpc.SendPaymentRequest,
case len(firstHopRecords) > 0:
// Continue below.

case req.Scid != 0:
var quote rfqmsg.SellAccept
for id, q := range r.cfg.RfqManager.PeerAcceptedSellQuotes() {
if id == rfqmsg.SerialisedScid(req.Scid) {
quote = q
break
}
}

htlc := rfqmsg.NewHtlc(nil, fn.Some(quote.ID))

// We'll now map the HTLC struct into a set of TLV records,
// which we can then encode into the expected map format.
htlcMapRecords, err := tlv.RecordsToMap(htlc.Records())
if err != nil {
return fmt.Errorf("unable to encode records as map: %w",
err)
}

pReq.FirstHopCustomRecords = htlcMapRecords

// The request wants to pay a specific invoice.
case pReq.PaymentRequest != "":
invoice, err := zpay32.Decode(
Expand Down

0 comments on commit f2557d3

Please sign in to comment.