From f4cb8986d19a0caa9a613a043bc023000706c007 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Tue, 15 Apr 2025 10:20:16 -0600 Subject: [PATCH] zcash_client_sqlite: SQLite primary key integers are i64, not u32 I'm not sure why this was interpreted as a u32 in the past, but it's wrong and induces unnecessary conversions/unwraps. --- zcash_client_sqlite/src/lib.rs | 2 +- .../wallet/init/migrations/transparent_gap_limit_handling.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zcash_client_sqlite/src/lib.rs b/zcash_client_sqlite/src/lib.rs index e7fdc55cd..788d00b50 100644 --- a/zcash_client_sqlite/src/lib.rs +++ b/zcash_client_sqlite/src/lib.rs @@ -224,7 +224,7 @@ impl AccountUuid { /// This is an ephemeral value for efficiently and generically working with accounts in a /// [`WalletDb`]. To reference accounts in external contexts, use [`AccountUuid`]. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Default, PartialOrd, Ord)] -pub(crate) struct AccountRef(u32); +pub(crate) struct AccountRef(i64); /// This implementation is retained under `#[cfg(test)]` for pre-AccountUuid testing. #[cfg(test)] diff --git a/zcash_client_sqlite/src/wallet/init/migrations/transparent_gap_limit_handling.rs b/zcash_client_sqlite/src/wallet/init/migrations/transparent_gap_limit_handling.rs index a9b65eff4..affbe19db 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/transparent_gap_limit_handling.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/transparent_gap_limit_handling.rs @@ -84,7 +84,7 @@ pub(super) fn insert_initial_transparent_addrs( ":key_scope_external": KeyScope::EXTERNAL.encode() ])?; while let Some(row) = min_addr_rows.next()? { - let account_id = AccountRef(row.get::<_, u32>("account_id")?); + let account_id = AccountRef(row.get("account_id")?); let min_transparent_idx = row .get::<_, Option>("transparent_child_index")? @@ -716,7 +716,7 @@ impl RusqliteMigration for Migra generate_gap_addresses( conn, &self.params, - AccountRef(account_id.try_into().unwrap()), + AccountRef(account_id), key_scope, &GapLimits::default(), UnifiedAddressRequest::unsafe_custom(Allow, Allow, Require),