cmd: exclude peers for easy autoloop

This commit is contained in:
Slyghtning 2025-10-08 16:47:13 +02:00
parent 854cac246e
commit bb8ee54817
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF

View file

@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"strconv"
"strings"
"github.com/lightninglabs/loop/liquidity"
"github.com/lightninglabs/loop/looprpc"
@ -350,6 +351,12 @@ var setParamsCommand = &cli.Command{
Usage: "the target size of total local balance in " +
"satoshis, used by easy autoloop.",
},
&cli.StringSliceFlag{
Name: "easyautoloop_excludepeer",
Usage: "list of peer pubkeys (hex) to exclude from " +
"easy autoloop channel selection; repeat " +
"--easyautoloop_excludepeer for multiple peers",
},
&cli.BoolFlag{
Name: "asset_easyautoloop",
Usage: "set to true to enable asset easy autoloop, which " +
@ -567,6 +574,27 @@ func setParams(ctx context.Context, cmd *cli.Command) error {
flagSet = true
}
if cmd.IsSet("easyautoloop_excludepeer") {
peers := cmd.StringSlice("easyautoloop_excludepeer")
// Reset and set according to a provided list.
params.EasyAutoloopExcludedPeers = make([][]byte, 0, len(peers))
for _, s := range peers {
s = strings.TrimSpace(s)
if s == "" {
continue
}
v, err := route.NewVertexFromStr(s)
if err != nil {
return fmt.Errorf("invalid peer pubkey "+
"%s: %v", s, err)
}
params.EasyAutoloopExcludedPeers = append(
params.EasyAutoloopExcludedPeers, v[:],
)
}
flagSet = true
}
if cmd.IsSet("asset_easyautoloop") {
if !cmd.IsSet("asset_id") {
return fmt.Errorf("asset_id must be set to use " +