Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion cmd/loop/liquidity.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ var setLiquidityRuleCommand = cli.Command{
Description: "Update or remove the liquidity rule for a channel/peer.",
ArgsUsage: "{shortchanid | peerpubkey}",
Flags: []cli.Flag{
cli.StringFlag{
Name: "type",
Usage: "the type of swap to perform, set to 'out' " +
"for acquiring inbound liquidity or 'in' for " +
"acquiring outbound liquidity.",
Value: "out",
},

cli.IntFlag{
Name: "incoming_threshold",
Usage: "the minimum percentage of incoming liquidity " +
Expand Down Expand Up @@ -168,7 +176,18 @@ func setRule(ctx *cli.Context) error {
newRule := &looprpc.LiquidityRule{
ChannelId: chanID,
Type: looprpc.LiquidityRuleType_THRESHOLD,
SwapType: looprpc.SwapType_LOOP_OUT,
}
if ctx.IsSet("type") {
switch ctx.String("type") {
case "in":
newRule.SwapType = looprpc.SwapType_LOOP_IN

case "out":
newRule.SwapType = looprpc.SwapType_LOOP_OUT

default:
return errors.New("please set type to in or out")
}
}

if pubkeyRule {
Expand Down Expand Up @@ -292,6 +311,11 @@ var setParamsCommand = cli.Command{
Usage: "the maximum amount in satoshis that the " +
"autoloop client will dispatch per-swap",
},
cli.IntFlag{
Name: "htlc_conf",
Usage: "the confirmation target for loop in on-chain " +
"htlcs",
},
},
Action: setParams,
}
Expand Down Expand Up @@ -422,6 +446,11 @@ func setParams(ctx *cli.Context) error {
flagSet = true
}

if ctx.IsSet("htlc_conf") {
params.HtlcConfTarget = int32(ctx.Int("htlc_conf"))
flagSet = true
}

if !flagSet {
return fmt.Errorf("at least one flag required to set params")
}
Expand Down
14 changes: 13 additions & 1 deletion docs/autoloop.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ following command:
loop setparams --autoloop=true
```

At present, autoloop can be configured to either acquire incoming liquidity
using loop out, or acquire outgoing liquidity using loop in. It cannot support
automated swaps in both directions. To set the type of swaps you would like
to automatically dispatch, use:
```
loop setparams --type={in|out}
```

Autoloop will perform loop out swaps *by default*.

Swaps that are dispatched by the autolooper can be identified in the output of
`ListSwaps` by their label field, which will contain: `[reserved]: autoloop-out`.

Expand Down Expand Up @@ -286,7 +296,9 @@ following reasons will be displayed:
* Fee insufficient: if the fees that a swap will cost are more than the
percentage of total swap amount that we allow, this reason will be displayed.
See [fees](#fees) to update this value.

* Loop in unreachable: if the client node is unreachable by the server
off-chain, this reason will be displayed. Try improving the connectivity of
your node so that it is reachable by the loop server.

Further details for all of these reasons can be found in loopd's debug level
logs.
Loading