loop: integrate the probe api with loop-in quote

In this commit we add a call to the new probe endpoint directly into the
loop-in quote call. Furthermore we add an option to include private
channels in the loopin swap payment request. This is also useful for when
users quote/probe directly using the client API and specify hop hints.
This commit is contained in:
Andras Banki-Horvath 2021-07-28 18:11:45 +02:00
parent f786aaa016
commit 0e7ed91d5d
No known key found for this signature in database
GPG key ID: 80E5375C094198D8
8 changed files with 368 additions and 311 deletions

View file

@ -82,9 +82,14 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig,
// Request current server loop in terms and use these to calculate the
// swap fee that we should subtract from the swap amount in the payment
// request that we send to the server.
// request that we send to the server. We pass nil as optional route
// hints as hop hint selection when generating invoices with private
// channels is an LND side black box feaure. Advanced users will quote
// directly anyway and there they have the option to add specific
// route hints.
quote, err := cfg.server.GetLoopInQuote(
globalCtx, request.Amount, cfg.lnd.NodePubkey, request.LastHop,
nil,
)
if err != nil {
return nil, wrapGrpcError("loop in terms", err)