Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lncli: improve error message for unlock commands #1193

Merged
merged 1 commit into from
May 8, 2018

Conversation

guggero
Copy link
Collaborator

@guggero guggero commented May 6, 2018

As reported in #1191, if you issue the unlock or create command again after the wallet is already unlocked, you get a strange error message:

[lncli] Wallet is encrypted. Please unlock using 'lncli unlock', or set password using 'lncli create' if this is the first time starting lnd.

This is because the UnlockerService is shut down after successful unlock and therefore the unlock commands aren't recognized on the gRPC interface any more (status=Unimplemented).

I improved the error message for this special case since the current message is very misleading.

Fixes #1191.

s, ok := status.FromError(err)

// If it's a command for the UnlockerService (like 'create' or
// 'unlock') but the wallet is already unlocked, then these methods
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lines should be wrapped at 80 chars.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were, actually. But because of the three levels of indentation it looks like more in the GitHub diff view.
I wrapped the longest line anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think the default tab width in my IDE is wrong, sorry. I‘ll re-format it again.

@guggero guggero force-pushed the lncli-double-unlock branch 2 times, most recently from d4eb77f to dfc2baa Compare May 7, 2018 15:41
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

Tested locally and works as advertised!

@Roasbeef Roasbeef merged commit 4a639fa into lightningnetwork:master May 8, 2018
@guggero guggero deleted the lncli-double-unlock branch May 8, 2018 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants