Skip to content

Commit 1e61510

Browse files
committed
loop: handle fast-flag in legacy loop-in
1 parent 1a5acdf commit 1e61510

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ func (s *Client) LoopInQuote(ctx context.Context,
843843
quote, err := s.Server.GetLoopInQuote(
844844
ctx, request.Amount, s.lndServices.NodePubkey, request.LastHop,
845845
request.RouteHints, request.Initiator, request.NumDeposits,
846+
request.Fast,
846847
)
847848
if err != nil {
848849
return nil, err

loopin.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig,
130130
// channels is an LND side black box feature. Advanced users will quote
131131
// directly anyway and there they have the option to add specific route
132132
// hints.
133+
numDeposits := uint32(0)
134+
fast := false
133135
quote, err := cfg.server.GetLoopInQuote(
134136
globalCtx, request.Amount, cfg.lnd.NodePubkey, request.LastHop,
135-
request.RouteHints, request.Initiator, 0,
137+
request.RouteHints, request.Initiator, numDeposits, fast,
136138
)
137139
if err != nil {
138140
return nil, wrapGrpcError("loop in terms", err)

server_mock_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func (s *serverMock) GetLoopInTerms(ctx context.Context, initiator string) (
226226

227227
func (s *serverMock) GetLoopInQuote(context.Context, btcutil.Amount,
228228
route.Vertex, *route.Vertex, [][]zpay32.HopHint, string,
229-
uint32) (*LoopInQuote, error) {
229+
uint32, bool) (*LoopInQuote, error) {
230230

231231
return &LoopInQuote{
232232
SwapFee: testSwapFee,

swap_server_client.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ type swapServerClient interface {
8282
GetLoopInQuote(ctx context.Context, amt btcutil.Amount,
8383
pubKey route.Vertex, lastHop *route.Vertex,
8484
routeHints [][]zpay32.HopHint,
85-
initiator string, numDeposits uint32) (*LoopInQuote, error)
85+
initiator string, numDeposits uint32,
86+
fast bool) (*LoopInQuote, error)
8687

8788
Probe(ctx context.Context, amt btcutil.Amount, target route.Vertex,
8889
lastHop *route.Vertex, routeHints [][]zpay32.HopHint) error
@@ -269,7 +270,7 @@ func (s *grpcSwapServerClient) GetLoopInTerms(ctx context.Context,
269270
func (s *grpcSwapServerClient) GetLoopInQuote(ctx context.Context,
270271
amt btcutil.Amount, pubKey route.Vertex, lastHop *route.Vertex,
271272
routeHints [][]zpay32.HopHint, initiator string,
272-
numDeposits uint32) (*LoopInQuote, error) {
273+
numDeposits uint32, fast bool) (*LoopInQuote, error) {
273274

274275
err := s.Probe(ctx, amt, pubKey, lastHop, routeHints)
275276
if err != nil && status.Code(err) != codes.Unavailable {
@@ -285,6 +286,7 @@ func (s *grpcSwapServerClient) GetLoopInQuote(ctx context.Context,
285286
Pubkey: pubKey[:],
286287
UserAgent: UserAgent(initiator),
287288
NumStaticAddressDeposits: numDeposits,
289+
Fast: fast,
288290
}
289291

290292
if lastHop != nil {

0 commit comments

Comments
 (0)