loopin: Add --route_hints parameter

Adds the --route_hints parameter to loop quote
routehints
Harsha Goli 3 years ago
parent 2e6adeaa3f
commit 5504368844
No known key found for this signature in database
GPG Key ID: 90E00CCB1C74C611

@ -2,6 +2,7 @@ package main
import (
"context"
"encoding/json"
"fmt"
"github.com/lightninglabs/loop"
@ -31,6 +32,11 @@ var (
"with our reserved prefix: %v.",
labels.MaxLength, labels.Reserved),
}
routeHintsFlag = cli.StringSliceFlag{
Name: "route_hints",
Usage: "Route hints that can each be individually used " +
"to assist in reaching the invoice's destination.",
}
loopInCommand = cli.Command{
Name: "in",
@ -61,6 +67,7 @@ var (
lastHopFlag,
labelFlag,
verboseFlag,
routeHintsFlag,
},
Action: loopIn,
}
@ -120,12 +127,20 @@ func loopIn(ctx *cli.Context) error {
lastHop = lastHopVertex[:]
}
var hints []*looprpc.RouteHint
if ctx.IsSet(routeHints.Name) {
err = json.Unmarshal([]byte(ctx.String(routeHints.Name)), &hints)
if err != nil {
return fmt.Errorf("unable to parse json: %v", err)
}
}
quoteReq := &looprpc.QuoteRequest{
Amt: int64(amt),
ConfTarget: htlcConfTarget,
ExternalHtlc: external,
LoopInLastHop: lastHop,
Amt: int64(amt),
ConfTarget: htlcConfTarget,
ExternalHtlc: external,
LoopInLastHop: lastHop,
LoopInRouteHints: hints,
}
quote, err := client.GetLoopInQuote(context.Background(), quoteReq)

Loading…
Cancel
Save