-
Notifications
You must be signed in to change notification settings - Fork 250
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
zcash_client_sqlite: Add unstable conversions between AccountId
and u32
.
#1557
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1557 +/- ##
==========================================
- Coverage 61.63% 61.62% -0.02%
==========================================
Files 148 148
Lines 18821 18825 +4
==========================================
Hits 11601 11601
- Misses 7220 7224 +4 ☔ View full report in Codecov by Sentry. |
ae012b3
to
58edf9c
Compare
… `u32` This is necessary for third parties using the `zcash_client_sqlite` crate directly to be able to refer to individual account IDs without having to always use FVKs to look them up.
58edf9c
to
cb349f8
Compare
/// Constructs an `AccountId` from a bare `u32` value. The resulting identifier is not | ||
/// guaranteed to correspond to any account stored in the database. | ||
#[cfg(feature = "unstable")] | ||
pub fn from_u32(value: u32) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be unsafe
?
pub fn from_u32(value: u32) -> Self { | |
pub unsafe fn from_u32(value: u32) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't unsafe, by any meaning of the term?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's up to the caller to maintain the intended invariant that AccountId
s are only constructed for accounts stored in the database, which isn't checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
This is necessary for third parties using the
zcash_client_sqlite
crate directly to be able to refer to individual account IDs without having to always use FVKs to look them up.