|
6 | 6 | "errors" |
7 | 7 | "fmt" |
8 | 8 | "strconv" |
| 9 | + "strings" |
9 | 10 |
|
10 | 11 | "github.com/lightninglabs/loop/liquidity" |
11 | 12 | "github.com/lightninglabs/loop/looprpc" |
@@ -350,6 +351,12 @@ var setParamsCommand = &cli.Command{ |
350 | 351 | Usage: "the target size of total local balance in " + |
351 | 352 | "satoshis, used by easy autoloop.", |
352 | 353 | }, |
| 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 | + }, |
353 | 360 | &cli.BoolFlag{ |
354 | 361 | Name: "asset_easyautoloop", |
355 | 362 | Usage: "set to true to enable asset easy autoloop, which " + |
@@ -567,6 +574,27 @@ func setParams(ctx context.Context, cmd *cli.Command) error { |
567 | 574 | flagSet = true |
568 | 575 | } |
569 | 576 |
|
| 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 | + |
570 | 598 | if cmd.IsSet("asset_easyautoloop") { |
571 | 599 | if !cmd.IsSet("asset_id") { |
572 | 600 | return fmt.Errorf("asset_id must be set to use " + |
|
0 commit comments