Skip to content
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

Add the option on path creator to specify the incoming channel on blinded path #9127

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
23 changes: 22 additions & 1 deletion cmd/commands/cmd_invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/hex"
"fmt"
"strconv"
"strings"

"github.com/lightningnetwork/lnd/lnrpc"
"github.com/urfave/cli"
Expand Down Expand Up @@ -116,6 +117,11 @@ var AddInvoiceCommand = cli.Command{
"use on a blinded path. The flag may be " +
"specified multiple times.",
},
cli.StringSliceFlag{
Name: "blinded_path_income_channel",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blinded_path_income_channel => blinded_path_incoming_channel_list

Usage: "The chained channels ids to be used in a " +
"blinded path as the income hops.",
Comment on lines +122 to +123
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Usage: "The chained channels ids to be used in a " +
"blinded path as the income hops.",
Chained channels (specified via channel id) starting from the receiver node which shall be used for the blinded path.

},
},
Action: actionDecorator(addInvoice),
}
Expand Down Expand Up @@ -202,7 +208,8 @@ func parseBlindedPathCfg(ctx *cli.Context) (*lnrpc.BlindedPathConfig, error) {
if ctx.IsSet("min_real_blinded_hops") ||
ctx.IsSet("num_blinded_hops") ||
ctx.IsSet("max_blinded_paths") ||
ctx.IsSet("blinded_path_omit_node") {
ctx.IsSet("blinded_path_omit_node") ||
ctx.IsSet("blinded_path_income_channel") {

return nil, fmt.Errorf("blinded path options are " +
"only used if the `--blind` options is set")
Expand Down Expand Up @@ -239,6 +246,20 @@ func parseBlindedPathCfg(ctx *cli.Context) (*lnrpc.BlindedPathConfig, error) {
)
}

if ctx.IsSet("blinded_path_income_channel") {
channels := strings.Split(
ctx.String("blinded_path_income_channel"), ",")
for _, chanID := range channels {
channelID, err := strconv.ParseUint(chanID, 10, 64)
if err != nil {
return nil, err
}
blindCfg.ChannelIncomeList = append(
blindCfg.ChannelIncomeList, channelID,
)
}
}

return &blindCfg, nil
}

Expand Down