Skip to content

Commit 5d840aa

Browse files
committed
cmd: exclude peers for easy autoloop
1 parent db2b27c commit 5d840aa

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

cmd/loop/liquidity.go

Lines changed: 29 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,12 @@ 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+
},
353360
&cli.BoolFlag{
354361
Name: "asset_easyautoloop",
355362
Usage: "set to true to enable asset easy autoloop, which " +
@@ -567,6 +574,28 @@ func setParams(ctx context.Context, cmd *cli.Command) error {
567574
flagSet = true
568575
}
569576

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

0 commit comments

Comments
 (0)