cli: add payment_timeout option to the CLI as well

Andras Banki-Horvath 3 weeks ago
parent 93af5c33b7
commit ff74ad2252
No known key found for this signature in database
GPG Key ID: 80E5375C094198D8

@ -92,6 +92,14 @@ var loopOutCommand = cli.Command{
"Not setting this flag therefore might " +
"result in a lower swap fee",
},
cli.DurationFlag{
Name: "payment_timeout",
Usage: "the timeout for each individual off-chain " +
"payment attempt. If not set, the default " +
"timeout of 1 hour will be used. As the " +
"payment might be retried, the actual total " +
"time may be longer",
},
forceFlag,
labelFlag,
verboseFlag,
@ -235,6 +243,15 @@ func loopOut(ctx *cli.Context) error {
}
}
paymentTimeout := 0
if ctx.IsSet("payment_timeout") {
paymentTimeout = int(ctx.Duration("payment_timeout").Seconds())
if paymentTimeout < 0 {
return fmt.Errorf("payment timeout must be a " +
"positive value")
}
}
resp, err := client.LoopOut(context.Background(), &looprpc.LoopOutRequest{
Amt: int64(amt),
Dest: destAddr,
@ -252,6 +269,7 @@ func loopOut(ctx *cli.Context) error {
SwapPublicationDeadline: uint64(swapDeadline.Unix()),
Label: label,
Initiator: defaultInitiator,
PaymentTimeout: uint32(paymentTimeout),
})
if err != nil {
return err

Loading…
Cancel
Save