Skip to content

Commit 249526d

Browse files
committed
cmd: exclude peers for easy autoloop
1 parent bf34990 commit 249526d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

cmd/loop/liquidity.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"fmt"
88
"strconv"
9+
"strings"
910

1011
"github.com/lightninglabs/loop/liquidity"
1112
"github.com/lightninglabs/loop/looprpc"
@@ -350,6 +351,13 @@ var setParamsCommand = cli.Command{
350351
Usage: "the target size of total local balance in " +
351352
"satoshis, used by easy autoloop.",
352353
},
354+
cli.StringSliceFlag{
355+
Name: "easyexcludepeer",
356+
Usage: "list of peer pubkeys (hex) to exclude from " +
357+
"easy autoloop channel selection; repeat " +
358+
"--easyexcludepeer for multiple peers",
359+
Value: &cli.StringSlice{},
360+
},
353361
cli.BoolFlag{
354362
Name: "asset_easyautoloop",
355363
Usage: "set to true to enable asset easy autoloop, which " +
@@ -567,6 +575,28 @@ func setParams(ctx *cli.Context) error {
567575
flagSet = true
568576
}
569577

578+
if ctx.IsSet("easyexcludepeer") {
579+
peers := ctx.StringSlice("easyexcludepeer")
580+
// Reset and set according to a provided list.
581+
params.EasyAutoloopExcludedPeers = nil
582+
for _, s := range peers {
583+
s = strings.TrimSpace(s)
584+
if s == "" {
585+
continue
586+
}
587+
v, err := route.NewVertexFromStr(s)
588+
if err != nil {
589+
return fmt.Errorf("invalid peer pubkey "+
590+
"%s: %v", s, err)
591+
}
592+
b := v[:]
593+
params.EasyAutoloopExcludedPeers = append(
594+
params.EasyAutoloopExcludedPeers, b,
595+
)
596+
}
597+
flagSet = true
598+
}
599+
570600
if ctx.IsSet("asset_easyautoloop") {
571601
if !ctx.IsSet("asset_id") {
572602
return fmt.Errorf("asset_id must be set to use " +

0 commit comments

Comments
 (0)