mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-28 08:27:11 +02:00
cmd/commands: update query+import+rc mc to accept an mc namespace
This commit is contained in:
@@ -31,6 +31,12 @@ var importMissionControlCommand = cli.Command{
|
|||||||
Name: "force",
|
Name: "force",
|
||||||
Usage: "whether to force the history entry import",
|
Usage: "whether to force the history entry import",
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "mission_control_namespace",
|
||||||
|
Usage: "an optional mission control namespace to import " +
|
||||||
|
"into. If not specified, the default " +
|
||||||
|
"mission control namespace will be used.",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +100,8 @@ func importMissionControl(ctx *cli.Context) error {
|
|||||||
Pairs: []*routerrpc.PairHistory{
|
Pairs: []*routerrpc.PairHistory{
|
||||||
importResult,
|
importResult,
|
||||||
},
|
},
|
||||||
Force: ctx.IsSet("force"),
|
Force: ctx.IsSet("force"),
|
||||||
|
MissionControlNamespace: ctx.String("mission_control_namespace"),
|
||||||
}
|
}
|
||||||
|
|
||||||
rpcCtx := context.Background()
|
rpcCtx := context.Background()
|
||||||
|
@@ -273,7 +273,15 @@ var queryMissionControlCommand = cli.Command{
|
|||||||
Name: "querymc",
|
Name: "querymc",
|
||||||
Category: "Mission Control",
|
Category: "Mission Control",
|
||||||
Usage: "Query the internal mission control state.",
|
Usage: "Query the internal mission control state.",
|
||||||
Action: actionDecorator(queryMissionControl),
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "mission_control_namespace",
|
||||||
|
Usage: "an optional mission control namespace to query. " +
|
||||||
|
"If not specified, the default mission control " +
|
||||||
|
"namespace will be used.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: actionDecorator(queryMissionControl),
|
||||||
}
|
}
|
||||||
|
|
||||||
func queryMissionControl(ctx *cli.Context) error {
|
func queryMissionControl(ctx *cli.Context) error {
|
||||||
@@ -283,7 +291,9 @@ func queryMissionControl(ctx *cli.Context) error {
|
|||||||
|
|
||||||
client := routerrpc.NewRouterClient(conn)
|
client := routerrpc.NewRouterClient(conn)
|
||||||
|
|
||||||
req := &routerrpc.QueryMissionControlRequest{}
|
req := &routerrpc.QueryMissionControlRequest{
|
||||||
|
MissionControlNamespace: ctx.String("mission_control_namespace"),
|
||||||
|
}
|
||||||
snapshot, err := client.QueryMissionControl(ctxc, req)
|
snapshot, err := client.QueryMissionControl(ctxc, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -299,8 +309,16 @@ var queryProbCommand = cli.Command{
|
|||||||
Category: "Mission Control",
|
Category: "Mission Control",
|
||||||
Usage: "Deprecated. Estimate a success probability.",
|
Usage: "Deprecated. Estimate a success probability.",
|
||||||
ArgsUsage: "from-node to-node amt",
|
ArgsUsage: "from-node to-node amt",
|
||||||
Action: actionDecorator(queryProb),
|
Flags: []cli.Flag{
|
||||||
Hidden: true,
|
&cli.StringFlag{
|
||||||
|
Name: "mission_control_namespace",
|
||||||
|
Usage: "an optional mission control namespace to query. " +
|
||||||
|
"If not specified, the default mission control " +
|
||||||
|
"namespace will be used.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: actionDecorator(queryProb),
|
||||||
|
Hidden: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func queryProb(ctx *cli.Context) error {
|
func queryProb(ctx *cli.Context) error {
|
||||||
@@ -336,9 +354,10 @@ func queryProb(ctx *cli.Context) error {
|
|||||||
client := routerrpc.NewRouterClient(conn)
|
client := routerrpc.NewRouterClient(conn)
|
||||||
|
|
||||||
req := &routerrpc.QueryProbabilityRequest{
|
req := &routerrpc.QueryProbabilityRequest{
|
||||||
FromNode: fromNode[:],
|
FromNode: fromNode[:],
|
||||||
ToNode: toNode[:],
|
ToNode: toNode[:],
|
||||||
AmtMsat: int64(amtMsat),
|
AmtMsat: int64(amtMsat),
|
||||||
|
MissionControlNamespace: ctx.String("mission_control_namespace"),
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := client.QueryProbability(ctxc, req)
|
response, err := client.QueryProbability(ctxc, req)
|
||||||
@@ -355,7 +374,15 @@ var resetMissionControlCommand = cli.Command{
|
|||||||
Name: "resetmc",
|
Name: "resetmc",
|
||||||
Category: "Mission Control",
|
Category: "Mission Control",
|
||||||
Usage: "Reset internal mission control state.",
|
Usage: "Reset internal mission control state.",
|
||||||
Action: actionDecorator(resetMissionControl),
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "mission_control_namespace",
|
||||||
|
Usage: "an optional mission control namespace to reset. " +
|
||||||
|
"If not specified, the default mission control " +
|
||||||
|
"namespace will be used.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: actionDecorator(resetMissionControl),
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetMissionControl(ctx *cli.Context) error {
|
func resetMissionControl(ctx *cli.Context) error {
|
||||||
@@ -365,7 +392,9 @@ func resetMissionControl(ctx *cli.Context) error {
|
|||||||
|
|
||||||
client := routerrpc.NewRouterClient(conn)
|
client := routerrpc.NewRouterClient(conn)
|
||||||
|
|
||||||
req := &routerrpc.ResetMissionControlRequest{}
|
req := &routerrpc.ResetMissionControlRequest{
|
||||||
|
MissionControlNamespace: ctx.String("mission_control_namespace"),
|
||||||
|
}
|
||||||
_, err := client.ResetMissionControl(ctxc, req)
|
_, err := client.ResetMissionControl(ctxc, req)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user