From 452022ee75e09f8091688aaaace5898854ae9c53 Mon Sep 17 00:00:00 2001 From: bitromortac Date: Tue, 6 May 2025 09:49:32 +0200 Subject: [PATCH] lncli: establish connection after mc parsing for loadmc It can take some time to unmarshal large mission control data sets such that the macaroon can expire during that phase. We postpone the connection establishment to give the user more time to answer the prompt. --- cmd/commands/cmd_import_mission_control.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/commands/cmd_import_mission_control.go b/cmd/commands/cmd_import_mission_control.go index 7f0f656f7..13cffe1ef 100644 --- a/cmd/commands/cmd_import_mission_control.go +++ b/cmd/commands/cmd_import_mission_control.go @@ -153,11 +153,6 @@ func loadMissionControl(ctx *cli.Context) error { return fmt.Errorf("%v does not exist", mcDataPath) } - conn := getClientConn(ctx, false) - defer conn.Close() - - client := routerrpc.NewRouterClient(conn) - // Load and unmarshal the querymc output file. mcRaw, err := os.ReadFile(mcDataPath) if err != nil { @@ -171,6 +166,11 @@ func loadMissionControl(ctx *cli.Context) error { err) } + conn := getClientConn(ctx, false) + defer conn.Close() + + client := routerrpc.NewRouterClient(conn) + // We discard mission control data if requested. if ctx.Bool("discard") { if !promptForConfirmation("This will discard all current " +