Skip to content

Commit 6acd76e

Browse files
committed
loopout: allow multi-loop
1 parent 710ae77 commit 6acd76e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lndclient/router_client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ type SendPaymentRequest struct {
9393
// LastHopPubkey is the pubkey of the last hop of the route taken
9494
// for this payment. If empty, any hop may be used.
9595
LastHopPubkey *route.Vertex
96+
97+
// The maximum number of partial payments that may be used to complete
98+
// the full amount.
99+
MaxShards uint32
96100
}
97101

98102
// routerClient is a wrapper around the generated routerrpc proxy.
@@ -120,6 +124,7 @@ func (r *routerClient) SendPayment(ctx context.Context,
120124
FeeLimitSat: int64(request.MaxFee),
121125
PaymentRequest: request.Invoice,
122126
TimeoutSeconds: int32(request.Timeout.Seconds()),
127+
MaxShards: request.MaxShards,
123128
}
124129
if request.MaxCltv != nil {
125130
rpcReq.CltvLimit = *request.MaxCltv

loopout.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ var (
4141
paymentTimeout = time.Minute
4242
)
4343

44+
const (
45+
// loopOutMaxShards defines that maximum number of shards that may be
46+
// used for a loop out swap.
47+
loopOutMaxShards = 5
48+
)
49+
4450
// loopOutSwap contains all the in-memory state related to a pending loop out
4551
// swap.
4652
type loopOutSwap struct {
@@ -452,6 +458,7 @@ func (s *loopOutSwap) payInvoiceAsync(ctx context.Context,
452458
Invoice: invoice,
453459
OutgoingChannel: outgoingChannel,
454460
Timeout: paymentTimeout,
461+
MaxShards: loopOutMaxShards,
455462
}
456463

457464
// Lookup state of the swap payment.

0 commit comments

Comments
 (0)