diff --git a/lndclient/router_client.go b/lndclient/router_client.go index fb8a4d6..a7b722b 100644 --- a/lndclient/router_client.go +++ b/lndclient/router_client.go @@ -93,6 +93,10 @@ type SendPaymentRequest struct { // LastHopPubkey is the pubkey of the last hop of the route taken // for this payment. If empty, any hop may be used. LastHopPubkey *route.Vertex + + // The maximum number of partial payments that may be used to complete + // the full amount. + MaxShards uint32 } // routerClient is a wrapper around the generated routerrpc proxy. @@ -120,6 +124,7 @@ func (r *routerClient) SendPayment(ctx context.Context, FeeLimitSat: int64(request.MaxFee), PaymentRequest: request.Invoice, TimeoutSeconds: int32(request.Timeout.Seconds()), + MaxShards: request.MaxShards, } if request.MaxCltv != nil { rpcReq.CltvLimit = *request.MaxCltv diff --git a/loopout.go b/loopout.go index 82c3ecc..e9f414e 100644 --- a/loopout.go +++ b/loopout.go @@ -41,6 +41,12 @@ var ( paymentTimeout = time.Minute ) +const ( + // loopOutMaxShards defines that maximum number of shards that may be + // used for a loop out swap. + loopOutMaxShards = 5 +) + // loopOutSwap contains all the in-memory state related to a pending loop out // swap. type loopOutSwap struct { @@ -452,6 +458,7 @@ func (s *loopOutSwap) payInvoiceAsync(ctx context.Context, Invoice: invoice, OutgoingChannel: outgoingChannel, Timeout: paymentTimeout, + MaxShards: loopOutMaxShards, } // Lookup state of the swap payment.