@@ -79,29 +79,36 @@ func newLoopOutSwap(globalCtx context.Context, cfg *swapConfig,
7979 // the server revocation key and the swap and prepay invoices.
8080 log .Infof ("Initiating swap request at height %v" , currentHeight )
8181
82- swapResp , err := cfg .server .NewLoopOutSwap (globalCtx , swapHash ,
83- request .Amount , receiverKey ,
82+ // The swap deadline will be given to the server for it to use as the
83+ // latest swap publication time.
84+ swapResp , err := cfg .server .NewLoopOutSwap (
85+ globalCtx , swapHash , request .Amount , receiverKey ,
86+ request .SwapPublicationDeadline ,
8487 )
8588 if err != nil {
8689 return nil , fmt .Errorf ("cannot initiate swap: %v" , err )
8790 }
8891
89- err = validateLoopOutContract (cfg .lnd , currentHeight , request , swapHash , swapResp )
92+ err = validateLoopOutContract (
93+ cfg .lnd , currentHeight , request , swapHash , swapResp ,
94+ )
9095 if err != nil {
9196 return nil , err
9297 }
9398
94- // Instantiate a struct that contains all required data to start the swap.
99+ // Instantiate a struct that contains all required data to start the
100+ // swap.
95101 initiationTime := time .Now ()
96102
97103 contract := loopdb.LoopOutContract {
98- SwapInvoice : swapResp .swapInvoice ,
99- DestAddr : request .DestAddr ,
100- MaxSwapRoutingFee : request .MaxSwapRoutingFee ,
101- SweepConfTarget : request .SweepConfTarget ,
102- UnchargeChannel : request .LoopOutChannel ,
103- PrepayInvoice : swapResp .prepayInvoice ,
104- MaxPrepayRoutingFee : request .MaxPrepayRoutingFee ,
104+ SwapInvoice : swapResp .swapInvoice ,
105+ DestAddr : request .DestAddr ,
106+ MaxSwapRoutingFee : request .MaxSwapRoutingFee ,
107+ SweepConfTarget : request .SweepConfTarget ,
108+ UnchargeChannel : request .LoopOutChannel ,
109+ PrepayInvoice : swapResp .prepayInvoice ,
110+ MaxPrepayRoutingFee : request .MaxPrepayRoutingFee ,
111+ SwapPublicationDeadline : request .SwapPublicationDeadline ,
105112 SwapContract : loopdb.SwapContract {
106113 InitiationHeight : currentHeight ,
107114 InitiationTime : initiationTime ,
0 commit comments