-
Notifications
You must be signed in to change notification settings - Fork 123
loop out: allow outbound channel set for multi-loops #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c6697da
ba55777
9927139
503c83c
c62acd5
bd6e3f4
044c1c1
8c544bf
ccec719
23a1e33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ package main | |
import ( | ||
"context" | ||
"fmt" | ||
"strconv" | ||
"strings" | ||
"time" | ||
|
||
"github.com/btcsuite/btcutil" | ||
|
@@ -25,10 +27,10 @@ var loopOutCommand = cli.Command{ | |
Optionally a BASE58/bech32 encoded bitcoin destination address may be | ||
specified. If not specified, a new wallet address will be generated.`, | ||
Flags: []cli.Flag{ | ||
cli.Uint64Flag{ | ||
cli.StringFlag{ | ||
Name: "channel", | ||
Usage: "the 8-byte compact channel ID of the channel " + | ||
"to loop out", | ||
Usage: "the comma-separated list of short " + | ||
"channel IDs of the channels to loop out", | ||
}, | ||
cli.StringFlag{ | ||
Name: "addr", | ||
|
@@ -87,6 +89,17 @@ func loopOut(ctx *cli.Context) error { | |
return err | ||
} | ||
|
||
// Parse outgoing channel set. | ||
chanStrings := strings.Split(ctx.String("channel"), ",") | ||
var outgoingChanSet []uint64 | ||
for _, chanString := range chanStrings { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any need to check that the set of channels provided are unique? I doubt it, but wanted to check that it won't behave strangely with duplicates on the lnd side. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is checked in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know how seriously we account for the alternate client case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The alternate client would still connect to |
||
chanID, err := strconv.ParseUint(chanString, 10, 64) | ||
if err != nil { | ||
return err | ||
} | ||
outgoingChanSet = append(outgoingChanSet, chanID) | ||
} | ||
|
||
var destAddr string | ||
switch { | ||
case ctx.IsSet("addr"): | ||
|
@@ -145,11 +158,6 @@ func loopOut(ctx *cli.Context) error { | |
return err | ||
} | ||
|
||
var unchargeChannel uint64 | ||
if ctx.IsSet("channel") { | ||
unchargeChannel = ctx.Uint64("channel") | ||
} | ||
|
||
resp, err := client.LoopOut(context.Background(), &looprpc.LoopOutRequest{ | ||
Amt: int64(amt), | ||
Dest: destAddr, | ||
|
@@ -158,7 +166,7 @@ func loopOut(ctx *cli.Context) error { | |
MaxSwapFee: int64(limits.maxSwapFee), | ||
MaxPrepayRoutingFee: int64(*limits.maxPrepayRoutingFee), | ||
MaxSwapRoutingFee: int64(*limits.maxSwapRoutingFee), | ||
LoopOutChannel: unchargeChannel, | ||
OutgoingChanSet: outgoingChanSet, | ||
SweepConfTarget: sweepConfTarget, | ||
SwapPublicationDeadline: uint64(swapDeadline.Unix()), | ||
}) | ||
|
Uh oh!
There was an error while loading. Please reload this page.