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

walletrpc: add default values to listunspent #6190

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

ErikEk
Copy link
Contributor

@ErikEk ErikEk commented Jan 21, 2022

Adds default values to walletrpc ListUnspent RPC call as requested in #6028.

Fixes #6028

@ErikEk ErikEk changed the title walletrpc: add defult values to listunspent walletrpc: add default values to listunspent Jan 26, 2022
@ErikEk ErikEk force-pushed the listunspent-deafult-values branch from 361ec28 to 5f3f40d Compare February 1, 2022 23:23
@ErikEk ErikEk marked this pull request as ready for review February 1, 2022 23:24
@ErikEk ErikEk force-pushed the listunspent-deafult-values branch from 5f3f40d to 3252c12 Compare February 1, 2022 23:27
@guggero guggero added this to the v0.15.0 milestone Feb 3, 2022
Copy link
Contributor

@positiveblue positiveblue left a comment

Choose a reason for hiding this comment

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

Thank you for the changes and for taking the time to make the ListUnspent comment clear.


/*
When min_confs and max_confs are zero, setting false implicitly
overrides max_confs to be MaxInt32, otherwise max_confs remains
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think there are some extra spaces here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@positiveblue I'm not sure if I saw the problem. Hope this look better.

@ErikEk ErikEk force-pushed the listunspent-deafult-values branch 2 times, most recently from 7f94691 to cb8e4ab Compare February 9, 2022 17:03
Copy link
Collaborator

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

Thanks for adding these @ErikEk ! since this is kinda repeating what is done on the lncli side, i think we can remove the default values from lncli now and just pass through the already existing unconfirmed_only flag in the request. Just so that we dont have duplicated logic for this. wdyt?

@@ -11,8 +11,14 @@ option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc";
// daemon's wallet.
service WalletKit {
/*
ListUnspent returns a list of all utxos spendable by the wallet with a
number of confirmations between the specified minimum and maximum.
ListUnspent lists for each spendable utxo currently in the wallet,
Copy link
Collaborator

Choose a reason for hiding this comment

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

im not sure that this comment is clearer. I think the previous comment is clear enough and then maybe we can just add something like "by default, all utxos are listed. To list only the unconfirmed utxos, set the unconfirmed_only to true."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ellemouton I agree.

@ErikEk
Copy link
Contributor Author

ErikEk commented Feb 17, 2022

@ellemouton Thank you for your input. listunspent (lncli listunspent/GET /v1/utxos) is deprecated and it is suggested we use walletrpc.ListUnspent instead.

Deprecated, use walletrpc.ListUnspent instead.

As is, there is no rpc (only REST) endpoint for listunspent functionality in the walletrpc subserver, hence there will be no duplication of logic.
I can add the rpc command lncli wallet listunspent if you want?

@ErikEk ErikEk force-pushed the listunspent-deafult-values branch 2 times, most recently from 3c0c0f0 to 0ee6907 Compare February 17, 2022 08:13
@ErikEk ErikEk force-pushed the listunspent-deafult-values branch from 0ee6907 to 74db83b Compare February 17, 2022 09:05
@lightninglabs-deploy
Copy link

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

Copy link
Collaborator

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

tACK! 🚀 thanks for this @ErikEk !

Comment on lines +15 to +17
number of confirmations between the specified minimum and maximum. By
default, all utxos are listed. To list only the unconfirmed utxos, set
the unconfirmed_only to true.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice 👍

@ellemouton
Copy link
Collaborator

As is, there is no rpc (only REST) endpoint for listunspent functionality in the walletrpc subserver, hence the will be no duplication of logic.

Indeed, you are correct. My bad 👍

@Roasbeef Roasbeef merged commit f13399b into lightningnetwork:master Mar 16, 2022
@joostjager
Copy link
Contributor

joostjager commented Oct 10, 2022

We found out that this PR is actually a breaking change for users that use min and max both at zero.

@ErikEk
Copy link
Contributor Author

ErikEk commented Oct 10, 2022

@joostjager Let me look into it.

@ErikEk
Copy link
Contributor Author

ErikEk commented Oct 14, 2022

@joostjager We had to override max_confs to be a MaxInt32, in order to return all confirmed and unconfirmed utxos as a default response. Before the change the command didn't worked as excepted.

@ErikEk
Copy link
Contributor Author

ErikEk commented Oct 14, 2022

I think this merge broke '/v1/utxos' but it was depreciated already.

@joostjager
Copy link
Contributor

We had to override max_confs to be a MaxInt32, in order to return all confirmed and unconfirmed utxos as a default response. Before the change the command didn't worked as excepted.

Yes, so this is exactly the breaking change. Previously the default behavior was to return only the unconfirmed utxos, and after the change it returns everything. Users relying on that can get into trouble.

@ErikEk
Copy link
Contributor Author

ErikEk commented Oct 14, 2022

@joostjager At this moment I'm not sure the best decision would be to reverse it to the old behavior, since we get the same issue but reversed (since this has been in the client for some time).

@joostjager
Copy link
Contributor

Yes, that's a dilemma indeed. Given that nobody complained yet beside me since the release of 0.15, it's probably fine to leave as is. Mainly wanted to flag it to perhaps give extra attention to this for future changes.

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.

walletrpc.ListUnspent RPC needs sane default values for max_confs and min_confs
7 participants