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

Should bdk_wallet::ChangeSet really be non_exhaustive? #1591

Open
tnull opened this issue Sep 5, 2024 · 0 comments
Open

Should bdk_wallet::ChangeSet really be non_exhaustive? #1591

tnull opened this issue Sep 5, 2024 · 0 comments
Labels
module-wallet new feature New feature or request
Milestone

Comments

@tnull
Copy link
Contributor

tnull commented Sep 5, 2024

Describe the enhancement
The non_exhaustive attribute disallows the construction of a type via struct expressions to make sure existing code doesn't break at compile time when new variants are added.

However, in case of ChangeSet I'd want to raise the question if we really want this behavior, or if you'd explicitly want existing code to break at compile time so that, if you implement custom serialization logic, you're forced to look at how to deal with the newly added field during version upgrades.

Otherwise, newly added field might get unnoticed by custom implementations as backwards compatibility should ensure prior code continues to be working, although then possibly not with the full feature set of the upgraded version.

FWIW, it's currently also inconsistent across ChangeSet types as all others are not non_exhaustive, meaning that any custom serialization implementation would break anyways as soon fields are added to one of them, just in case of bdk_wallet::ChangeSet the API is different.

Use case
Implementing custom serialization logic. Currently, you have to call ChangeSet::default() and override any deserialized fields manually.

@tnull tnull added the new feature New feature or request label Sep 5, 2024
@notmandatory notmandatory added this to the 1.0.0-beta milestone Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-wallet new feature New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants