@@ -14,7 +14,6 @@ import (
1414 "github.com/lightninglabs/loop/lsat"
1515 "github.com/lightninglabs/loop/swap"
1616 "github.com/lightninglabs/loop/sweep"
17- "github.com/lightningnetwork/lnd/lntypes"
1817)
1918
2019var (
@@ -354,32 +353,37 @@ func (s *Client) resumeSwaps(ctx context.Context,
354353//
355354// The return value is a hash that uniquely identifies the new swap.
356355func (s * Client ) LoopOut (globalCtx context.Context ,
357- request * OutRequest ) (* lntypes. Hash , btcutil. Address , error ) {
356+ request * OutRequest ) (* LoopOutSwapInfo , error ) {
358357
359358 log .Infof ("LoopOut %v to %v (channels: %v)" ,
360359 request .Amount , request .DestAddr , request .OutgoingChanSet ,
361360 )
362361
363362 if err := s .waitForInitialized (globalCtx ); err != nil {
364- return nil , nil , err
363+ return nil , err
365364 }
366365
367366 // Create a new swap object for this swap.
368367 initiationHeight := s .executor .height ()
369368 swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server )
370- swap , err := newLoopOutSwap (
369+ initResult , err := newLoopOutSwap (
371370 globalCtx , swapCfg , initiationHeight , request ,
372371 )
373372 if err != nil {
374- return nil , nil , err
373+ return nil , err
375374 }
375+ swap := initResult .swap
376376
377377 // Post swap to the main loop.
378378 s .executor .initiateSwap (globalCtx , swap )
379379
380380 // Return hash so that the caller can identify this swap in the updates
381381 // stream.
382- return & swap .hash , swap .htlc .Address , nil
382+ return & LoopOutSwapInfo {
383+ SwapHash : swap .hash ,
384+ HtlcAddressP2WSH : swap .htlc .Address ,
385+ ServerMessage : initResult .serverMessage ,
386+ }, nil
383387}
384388
385389// LoopOutQuote takes a LoopOut amount and returns a break down of estimated
@@ -480,12 +484,13 @@ func (s *Client) LoopIn(globalCtx context.Context,
480484 // Create a new swap object for this swap.
481485 initiationHeight := s .executor .height ()
482486 swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server )
483- swap , err := newLoopInSwap (
487+ initResult , err := newLoopInSwap (
484488 globalCtx , swapCfg , initiationHeight , request ,
485489 )
486490 if err != nil {
487491 return nil , err
488492 }
493+ swap := initResult .swap
489494
490495 // Post swap to the main loop.
491496 s .executor .initiateSwap (globalCtx , swap )
@@ -496,6 +501,7 @@ func (s *Client) LoopIn(globalCtx context.Context,
496501 SwapHash : swap .hash ,
497502 HtlcAddressP2WSH : swap .htlcP2WSH .Address ,
498503 HtlcAddressNP2WSH : swap .htlcNP2WSH .Address ,
504+ ServerMessage : initResult .serverMessage ,
499505 }
500506 return swapInfo , nil
501507}
0 commit comments