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

refactor(wallet)!: rename method to last_unused_address #1680

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oleonardolima
Copy link
Contributor

@oleonardolima oleonardolima commented Nov 12, 2024

Description

As per both out-of-band discussions, and the latest discussion at weekly development call, the semantics of this method can be misleading, as it's not guaranteed you get a next one on every call, that'd only happen if the address has been used and the application synced with latest blockchain state.

Renaming it to last_unused_address gives it a better semantics, as you'll always get the last derived address which still unused. As per usage where the user needs always a new derived address on every call, you should still use the reveal_next_address, nothing changed.

Notes to the reviewers

I'm open for discussions/suggestions on naming alternatives and better semantics. I think last_unused_address is pretty good, but maybe you can come up with another better one.

Changelog notice

  • Change Wallet::next_unused_address method to Wallet::last_unused_address.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@notmandatory notmandatory added module-wallet api A breaking API change labels Nov 15, 2024
@notmandatory notmandatory added this to the 1.0.0-beta milestone Nov 15, 2024
@oleonardolima oleonardolima force-pushed the refactor/next-unused-address-rename-to-last-unused-address branch from 168fbbe to 83f86cd Compare November 19, 2024 03:30
@oleonardolima oleonardolima marked this pull request as ready for review November 19, 2024 03:34
As per both out-of-band discussions, and the latest discussion at weekly
development call, the semantics of this method can be misleading, as
it's not guaranteed you get a next one on every call, that'd only happen
if the address has been used and the application synced with latest
blockchain state.

Renaming it to `last_unused_address` gives it a better semantics, as
you'll always get the last derived address which still unused. As per
usage where the user needs always a new derived address on every call,
you should still use the `reveal_next_address`, nothing changed.
@oleonardolima oleonardolima force-pushed the refactor/next-unused-address-rename-to-last-unused-address branch from 83f86cd to 07b85ca Compare November 19, 2024 03:36
notmandatory
notmandatory previously approved these changes Nov 19, 2024
Copy link
Member

@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

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

ACK 07b85ca

New name looks good to me.

@evanlinjin
Copy link
Member

Okay thinking about it, this method actually returns the earliest unused...

@notmandatory
Copy link
Member

lets make this a doc only change

@notmandatory notmandatory added documentation Improvements or additions to documentation and removed api A breaking API change labels Nov 20, 2024
@notmandatory notmandatory removed this from the 1.0.0-beta milestone Nov 20, 2024
@oleonardolima
Copy link
Contributor Author

As per last call discussion, I'll repurpose this PR to keep next_unused_address API, focusing only on improving the current documentation.

@notmandatory notmandatory dismissed their stale review November 21, 2024 18:15

Will re-review after new direction changes pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation module-wallet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants