@@ -112,6 +112,12 @@ func newLoopOutSwap(globalCtx context.Context, cfg *swapConfig,
112112 return nil , err
113113 }
114114
115+ // Check channel set for duplicates.
116+ chanSet , err := loopdb .NewChannelSet (request .OutgoingChanSet )
117+ if err != nil {
118+ return nil , err
119+ }
120+
115121 // Instantiate a struct that contains all required data to start the
116122 // swap.
117123 initiationTime := time .Now ()
@@ -121,7 +127,6 @@ func newLoopOutSwap(globalCtx context.Context, cfg *swapConfig,
121127 DestAddr : request .DestAddr ,
122128 MaxSwapRoutingFee : request .MaxSwapRoutingFee ,
123129 SweepConfTarget : request .SweepConfTarget ,
124- UnchargeChannel : request .LoopOutChannel ,
125130 PrepayInvoice : swapResp .prepayInvoice ,
126131 MaxPrepayRoutingFee : request .MaxPrepayRoutingFee ,
127132 SwapPublicationDeadline : request .SwapPublicationDeadline ,
@@ -136,6 +141,7 @@ func newLoopOutSwap(globalCtx context.Context, cfg *swapConfig,
136141 MaxMinerFee : request .MaxMinerFee ,
137142 MaxSwapFee : request .MaxSwapFee ,
138143 },
144+ OutgoingChanSet : chanSet ,
139145 }
140146
141147 swapKit := newSwapKit (
@@ -430,15 +436,9 @@ func (s *loopOutSwap) payInvoices(ctx context.Context) {
430436 // Pay the swap invoice.
431437 s .log .Infof ("Sending swap payment %v" , s .SwapInvoice )
432438
433- var outgoingChanIds []uint64
434- if s .LoopOutContract .UnchargeChannel != nil {
435- outgoingChanIds = append (
436- outgoingChanIds , * s .LoopOutContract .UnchargeChannel ,
437- )
438- }
439-
440439 s .swapPaymentChan = s .payInvoice (
441- ctx , s .SwapInvoice , s .MaxSwapRoutingFee , outgoingChanIds ,
440+ ctx , s .SwapInvoice , s .MaxSwapRoutingFee ,
441+ s .LoopOutContract .OutgoingChanSet ,
442442 )
443443
444444 // Pay the prepay invoice.
@@ -452,7 +452,7 @@ func (s *loopOutSwap) payInvoices(ctx context.Context) {
452452// payInvoice pays a single invoice.
453453func (s * loopOutSwap ) payInvoice (ctx context.Context , invoice string ,
454454 maxFee btcutil.Amount ,
455- outgoingChanIds [] uint64 ) chan lndclient.PaymentResult {
455+ outgoingChanIds loopdb. ChannelSet ) chan lndclient.PaymentResult {
456456
457457 resultChan := make (chan lndclient.PaymentResult )
458458
@@ -481,8 +481,8 @@ func (s *loopOutSwap) payInvoice(ctx context.Context, invoice string,
481481
482482// payInvoiceAsync is the asynchronously executed part of paying an invoice.
483483func (s * loopOutSwap ) payInvoiceAsync (ctx context.Context ,
484- invoice string , maxFee btcutil.Amount , outgoingChanIds [] uint64 ) (
485- * lndclient.PaymentStatus , error ) {
484+ invoice string , maxFee btcutil.Amount ,
485+ outgoingChanIds loopdb. ChannelSet ) ( * lndclient.PaymentStatus , error ) {
486486
487487 // Extract hash from payment request. Unfortunately the request
488488 // components aren't available directly.
0 commit comments