diff --git a/zcash_client_backend/CHANGELOG.md b/zcash_client_backend/CHANGELOG.md index 013662a97..60cc3ca5b 100644 --- a/zcash_client_backend/CHANGELOG.md +++ b/zcash_client_backend/CHANGELOG.md @@ -64,6 +64,11 @@ and this library adheres to Rust's notion of - Almost all uses of `Amount` in `zcash_client_backend::zip321` have been replaced with `NonNegativeAmount`. +### Removed +- `zcash_client_backend::data_api::WalletRead::is_valid_account_extfvk` has been + removed; it was unused in the ECC mobile wallet SDKs and has been superseded by + `get_account_for_ufvk`. + ## [0.10.0] - 2023-09-25 ### Notable Changes diff --git a/zcash_client_backend/src/data_api.rs b/zcash_client_backend/src/data_api.rs index 1253dbf98..284247403 100644 --- a/zcash_client_backend/src/data_api.rs +++ b/zcash_client_backend/src/data_api.rs @@ -23,7 +23,7 @@ use zcash_primitives::{ }, Transaction, TxId, }, - zip32::{AccountId, ExtendedFullViewingKey}, + zip32::AccountId, }; use crate::{ @@ -326,13 +326,6 @@ pub trait WalletRead { ufvk: &UnifiedFullViewingKey, ) -> Result, Self::Error>; - /// Checks whether the specified extended full viewing key is associated with the account. - fn is_valid_account_extfvk( - &self, - account: AccountId, - extfvk: &ExtendedFullViewingKey, - ) -> Result; - /// Returns the wallet balances and sync status for an account given the specified minimum /// number of confirmations, or `Ok(None)` if the wallet has no balance data available. fn get_wallet_summary( @@ -950,7 +943,7 @@ pub mod testing { components::{Amount, OutPoint}, Transaction, TxId, }, - zip32::{AccountId, ExtendedFullViewingKey}, + zip32::AccountId, }; use crate::{ @@ -1064,14 +1057,6 @@ pub mod testing { Ok(None) } - fn is_valid_account_extfvk( - &self, - _account: AccountId, - _extfvk: &ExtendedFullViewingKey, - ) -> Result { - Ok(false) - } - fn get_wallet_summary( &self, _min_confirmations: u32, diff --git a/zcash_client_sqlite/src/lib.rs b/zcash_client_sqlite/src/lib.rs index c35a42d18..37f59cbf8 100644 --- a/zcash_client_sqlite/src/lib.rs +++ b/zcash_client_sqlite/src/lib.rs @@ -61,7 +61,7 @@ use zcash_primitives::{ }, Transaction, TxId, }, - zip32::{AccountId, DiversifierIndex, ExtendedFullViewingKey}, + zip32::{AccountId, DiversifierIndex}, }; use zcash_client_backend::{ @@ -247,14 +247,6 @@ impl, P: consensus::Parameters> WalletRead for W wallet::get_account_for_ufvk(self.conn.borrow(), &self.params, ufvk) } - fn is_valid_account_extfvk( - &self, - account: AccountId, - extfvk: &ExtendedFullViewingKey, - ) -> Result { - wallet::is_valid_account_extfvk(self.conn.borrow(), &self.params, account, extfvk) - } - fn get_wallet_summary( &self, min_confirmations: u32, diff --git a/zcash_client_sqlite/src/wallet.rs b/zcash_client_sqlite/src/wallet.rs index a74ee67f0..650eb3175 100644 --- a/zcash_client_sqlite/src/wallet.rs +++ b/zcash_client_sqlite/src/wallet.rs @@ -65,7 +65,7 @@ //! - `memo` the shielded memo associated with the output, if any. use incrementalmerkletree::Retention; -use rusqlite::{self, named_params, OptionalExtension, ToSql}; +use rusqlite::{self, named_params, OptionalExtension}; use shardtree::ShardTree; use std::cmp; use std::collections::{BTreeMap, HashMap}; @@ -89,10 +89,7 @@ use zcash_primitives::{ memo::{Memo, MemoBytes}, merkle_tree::read_commitment_tree, transaction::{components::Amount, Transaction, TxId}, - zip32::{ - sapling::{DiversifiableFullViewingKey, ExtendedFullViewingKey}, - AccountId, DiversifierIndex, - }, + zip32::{AccountId, DiversifierIndex}, }; use zcash_client_backend::{ @@ -461,37 +458,6 @@ pub(crate) fn get_account_for_ufvk( .map_err(SqliteClientError::from) } -/// Checks whether the specified [`ExtendedFullViewingKey`] is valid and corresponds to the -/// specified account. -/// -/// [`ExtendedFullViewingKey`]: zcash_primitives::zip32::ExtendedFullViewingKey -pub(crate) fn is_valid_account_extfvk( - conn: &rusqlite::Connection, - params: &P, - account: AccountId, - extfvk: &ExtendedFullViewingKey, -) -> Result { - conn.prepare("SELECT ufvk FROM accounts WHERE account = ?")? - .query_row([u32::from(account).to_sql()?], |row| { - row.get(0).map(|ufvk_str: String| { - UnifiedFullViewingKey::decode(params, &ufvk_str) - .map_err(SqliteClientError::CorruptedData) - }) - }) - .optional() - .map_err(SqliteClientError::from) - .and_then(|row| { - if let Some(ufvk) = row { - ufvk.map(|ufvk| { - ufvk.sapling().map(|dfvk| dfvk.to_bytes()) - == Some(DiversifiableFullViewingKey::from(extfvk.clone()).to_bytes()) - }) - } else { - Ok(false) - } - }) -} - pub(crate) trait ScanProgress { fn sapling_scan_progress( &self,