@@ -3,6 +3,7 @@ package main
3
3
import (
4
4
"context"
5
5
"fmt"
6
+ "math"
6
7
"strconv"
7
8
"strings"
8
9
"time"
@@ -92,6 +93,14 @@ var loopOutCommand = cli.Command{
92
93
"Not setting this flag therefore might " +
93
94
"result in a lower swap fee" ,
94
95
},
96
+ cli.DurationFlag {
97
+ Name : "payment_timeout" ,
98
+ Usage : "the timeout for each individual off-chain " +
99
+ "payment attempt. If not set, the default " +
100
+ "timeout of 1 hour will be used. As the " +
101
+ "payment might be retried, the actual total " +
102
+ "time may be longer" ,
103
+ },
95
104
forceFlag ,
96
105
labelFlag ,
97
106
verboseFlag ,
@@ -235,6 +244,25 @@ func loopOut(ctx *cli.Context) error {
235
244
}
236
245
}
237
246
247
+ var paymentTimeout int64
248
+ if ctx .IsSet ("payment_timeout" ) {
249
+ parsedTimeout := ctx .Duration ("payment_timeout" )
250
+ if parsedTimeout .Truncate (time .Second ) != parsedTimeout {
251
+ return fmt .Errorf ("payment timeout must be a " +
252
+ "whole number of seconds" )
253
+ }
254
+
255
+ paymentTimeout = int64 (parsedTimeout .Seconds ())
256
+ if paymentTimeout <= 0 {
257
+ return fmt .Errorf ("payment timeout must be a " +
258
+ "positive value" )
259
+ }
260
+
261
+ if paymentTimeout > math .MaxUint32 {
262
+ return fmt .Errorf ("payment timeout is too large" )
263
+ }
264
+ }
265
+
238
266
resp , err := client .LoopOut (context .Background (), & looprpc.LoopOutRequest {
239
267
Amt : int64 (amt ),
240
268
Dest : destAddr ,
@@ -252,6 +280,7 @@ func loopOut(ctx *cli.Context) error {
252
280
SwapPublicationDeadline : uint64 (swapDeadline .Unix ()),
253
281
Label : label ,
254
282
Initiator : defaultInitiator ,
283
+ PaymentTimeout : uint32 (paymentTimeout ),
255
284
})
256
285
if err != nil {
257
286
return err
0 commit comments