mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopin: Add --route_hints parameter
Adds the --route_hints parameter to loop quote
This commit is contained in:
parent
2e6adeaa3f
commit
5504368844
1 changed files with 19 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue