Skip to content

Commit e4ffb08

Browse files
authored
Merge pull request #128 from Free-FreeThinker/free--max-routing-fee-config
Add option for max swap off-chain routing fee
2 parents d9597e8 + 321f5f7 commit e4ffb08

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmd/loop/loopout.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"time"
77

8+
"github.com/btcsuite/btcutil"
89
"github.com/lightninglabs/loop"
910
"github.com/lightninglabs/loop/looprpc"
1011
"github.com/lightninglabs/loop/swap"
@@ -45,6 +46,11 @@ var loopOutCommand = cli.Command{
4546
"should be swept within",
4647
Value: uint64(loop.DefaultSweepConfTarget),
4748
},
49+
cli.Int64Flag{
50+
Name: "max_swap_routing_fee",
51+
Usage: "the max off-chain swap routing fee in satoshis, " +
52+
"if let blank a default max fee will be used",
53+
},
4854
cli.BoolFlag{
4955
Name: "fast",
5056
Usage: "Indicate you want to swap immediately, " +
@@ -123,6 +129,12 @@ func loopOut(ctx *cli.Context) error {
123129
}
124130

125131
limits := getLimits(amt, quote)
132+
// If configured, use the specified maximum swap routing fee.
133+
if ctx.IsSet("max_swap_routing_fee") {
134+
*limits.maxSwapRoutingFee = btcutil.Amount(
135+
ctx.Int64("max_swap_routing_fee"),
136+
)
137+
}
126138
err = displayLimits(swap.TypeOut, amt, limits, false, warning)
127139
if err != nil {
128140
return err

0 commit comments

Comments
 (0)