mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-26 21:51:27 +02:00
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.
This commit is contained in:
@@ -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 " +
|
||||
|
Reference in New Issue
Block a user