loopout: allow multi-loop

pull/178/head
Joost Jager 4 years ago
parent 710ae77750
commit 6acd76e237
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -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

@ -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.

Loading…
Cancel
Save