loop: add support for the probe API

This commit is contained in:
Andras Banki-Horvath 2021-05-10 16:55:53 +02:00
parent 7d044f58e8
commit f786aaa016
No known key found for this signature in database
GPG key ID: 80E5375C094198D8
20 changed files with 2118 additions and 849 deletions

View file

@ -8,6 +8,7 @@ import (
"github.com/lightninglabs/loop/swap"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/zpay32"
)
// OutRequest contains the required parameters for a loop out swap.
@ -243,6 +244,11 @@ type LoopInQuoteRequest struct {
// ExternalHtlc specifies whether the htlc is published by an external
// source.
ExternalHtlc bool
// LastHop is an optional last hop to use. This last hop is used when
// the client has already requested a server probe for more accurate
// routing fee estimation.
LastHop *route.Vertex
}
// LoopInQuote contains estimates for the fees making up the total swap cost
@ -340,3 +346,15 @@ func (s *In) LastUpdate() time.Time {
func (s *In) SwapHash() lntypes.Hash {
return s.Hash
}
// ProbeRequest specifies probe parameters for the server probe.
type ProbeRequest struct {
// Amount is the amount that will be probed.
Amount btcutil.Amount
// LastHop is the last hop along the route.
LastHop *route.Vertex
// Optional hop hints.
RouteHints [][]zpay32.HopHint
}