Skip to content

Commit 5504368

Browse files
committed
loopin: Add --route_hints parameter
Adds the --route_hints parameter to loop quote
1 parent 2e6adea commit 5504368

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

cmd/loop/loopin.go

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"encoding/json"
56
"fmt"
67

78
"github.com/lightninglabs/loop"
@@ -31,6 +32,11 @@ var (
3132
"with our reserved prefix: %v.",
3233
labels.MaxLength, labels.Reserved),
3334
}
35+
routeHintsFlag = cli.StringSliceFlag{
36+
Name: "route_hints",
37+
Usage: "Route hints that can each be individually used " +
38+
"to assist in reaching the invoice's destination.",
39+
}
3440

3541
loopInCommand = cli.Command{
3642
Name: "in",
@@ -61,6 +67,7 @@ var (
6167
lastHopFlag,
6268
labelFlag,
6369
verboseFlag,
70+
routeHintsFlag,
6471
},
6572
Action: loopIn,
6673
}
@@ -120,12 +127,20 @@ func loopIn(ctx *cli.Context) error {
120127

121128
lastHop = lastHopVertex[:]
122129
}
130+
var hints []*looprpc.RouteHint
131+
if ctx.IsSet(routeHints.Name) {
132+
err = json.Unmarshal([]byte(ctx.String(routeHints.Name)), &hints)
133+
if err != nil {
134+
return fmt.Errorf("unable to parse json: %v", err)
135+
}
136+
}
123137

124138
quoteReq := &looprpc.QuoteRequest{
125-
Amt: int64(amt),
126-
ConfTarget: htlcConfTarget,
127-
ExternalHtlc: external,
128-
LoopInLastHop: lastHop,
139+
Amt: int64(amt),
140+
ConfTarget: htlcConfTarget,
141+
ExternalHtlc: external,
142+
LoopInLastHop: lastHop,
143+
LoopInRouteHints: hints,
129144
}
130145

131146
quote, err := client.GetLoopInQuote(context.Background(), quoteReq)

0 commit comments

Comments
 (0)