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

lnrpc: include a status indicator for channel verification operations #7476

Conversation

ardevd
Copy link
Contributor

@ardevd ardevd commented Mar 3, 2023

Change Description

Description of change / link to associated issue.

Steps to Test

  1. Export a backup.
  2. Verify the backup with lncli verifychanbackup.
    Response now includes a success indicator.

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

@ardevd
Copy link
Contributor Author

ardevd commented Mar 3, 2023

I also wonder if we want to keep it so that the verification returns an error directly or whether the rpc response can set success to false and include an optional message in the response? Thoughts?

@guggero
Copy link
Collaborator

guggero commented Mar 6, 2023

I also wonder if we want to keep it so that the verification returns an error directly or whether the rpc response can set success to false and include an optional message in the response? Thoughts?

I don't think we want to change that behavior. When using RPCs programmatically you want to be sure that you get an RPC error back when something goes wrong. If there is no error, you can assume that everything was fine. That's the reason why the original response was empty, because there can only ever be failure or success (which makes sense on an API level but looks weird on the command line). So this PR is purely cosmetic for the CLI user but shouldn't change the RPC/API behavior.

Code looks like it should be working, but can you add a check here that the return value is true now? And add release notes for 0.16.1 as well as run the formatter. Thanks!

@ardevd ardevd force-pushed the 7440-channel-backup-verify-success-indicator branch from d7a8026 to 102ba21 Compare March 6, 2023 20:03
@ardevd
Copy link
Contributor Author

ardevd commented Mar 6, 2023

@guggero Done!

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM 🎉

Just two small nits remaining.

itest/lnd_channel_backup_test.go Outdated Show resolved Hide resolved
itest/lnd_channel_backup_test.go Outdated Show resolved Hide resolved
@ardevd ardevd force-pushed the 7440-channel-backup-verify-success-indicator branch from 71cbc19 to 468cf83 Compare March 7, 2023 11:32
@guggero guggero requested a review from yyforyongyu March 7, 2023 12:01
@guggero guggero added this to the v0.16.1 milestone Mar 7, 2023
@@ -7148,7 +7148,9 @@ func (r *rpcServer) VerifyChanBackup(ctx context.Context,
}
}

return &lnrpc.VerifyChanBackupResponse{}, nil
return &lnrpc.VerifyChanBackupResponse{
Success: true,
Copy link
Member

Choose a reason for hiding this comment

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

Can this ever be false?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, this is purely to improve the output on the command line (which currently is just empty braces).

@saubyk saubyk changed the base branch from master to 0-16-1-staging March 16, 2023 15:26
@guggero
Copy link
Collaborator

guggero commented Mar 17, 2023

@ardevd can you rebase this on top of the 0-16-1-staging branch please? Then we can get it merged.

@ardevd
Copy link
Contributor Author

ardevd commented Mar 29, 2023

Of course. However, having spent more time with lnd I realize that the empty json responses are used quite extensively to indicate a successful operation. Introducing a "success" indicator for backup verification alone might add more confusion than clarity. Any thoughts @guggero ?

@guggero
Copy link
Collaborator

guggero commented Mar 29, 2023

Yes, it takes some getting used to, but eventually it's easy to interpret the "no error message means success" pattern of lnd. Though I think it would be quite nice if we at least got an idea of what's in a backup? So we could instead return the number of channels contained (doesn't make a lot of sense for a single backup file) or the channel points of the backup?

@ardevd
Copy link
Contributor Author

ardevd commented Mar 29, 2023

Agreed. Makes more sense than to effectively have a hardcoded Boolean value. It would actually be pretty useful to get an indication of the number of channel points that were indeed processed/verified.

@saubyk saubyk modified the milestones: v0.16.1, v0.17.0 Mar 30, 2023
@yyforyongyu
Copy link
Member

Should we rebase this, update the 0.17.0 release notes, and merge it?

@guggero
Copy link
Collaborator

guggero commented Jun 5, 2023

I can take this over for 0.17. Would be nice to get a list of channel points contained in a backup instead of just a boolean value. @ardevd do you plan on continuing with this or should I take it over?

@ardevd
Copy link
Contributor Author

ardevd commented Jun 5, 2023

I'd love to work on this but am currently pretty time constrained. Happy for you to take it over @guggero :)

@lightninglabs-deploy
Copy link

@ardevd, remember to re-request review from reviewers when ready

@yyforyongyu
Copy link
Member

Closed due to inactivity.

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.

5 participants