Skip to content

Commit e0bc1fa

Browse files
committed
cmd: exclude peers for easy autoloop
1 parent 0f3c4dc commit e0bc1fa

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

cmd/loop/liquidity.go

Lines changed: 28 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,27 @@ 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 = make([][]byte, 0, len(peers))
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+
params.EasyAutoloopExcludedPeers = append(
592+
params.EasyAutoloopExcludedPeers, v[:],
593+
)
594+
}
595+
flagSet = true
596+
}
597+
570598
if cmd.IsSet("asset_easyautoloop") {
571599
if !cmd.IsSet("asset_id") {
572600
return fmt.Errorf("asset_id must be set to use " +

0 commit comments

Comments
 (0)