mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
cmd: exclude peers for easy autoloop
This commit is contained in:
parent
854cac246e
commit
bb8ee54817
1 changed files with 28 additions and 0 deletions
|
|
@ -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 " +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue