Merge pull request #1026 from nuttycom/wallet/remove_extfvk_api
zcash_client_backend: remove `WalletRead::is_valid_account_extfvk`
This commit is contained in:
commit
be8daefb84
|
@ -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
|
||||
|
|
|
@ -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<Option<AccountId>, 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<bool, Self::Error>;
|
||||
|
||||
/// 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<bool, Self::Error> {
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
fn get_wallet_summary(
|
||||
&self,
|
||||
_min_confirmations: u32,
|
||||
|
|
|
@ -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<C: Borrow<rusqlite::Connection>, 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<bool, Self::Error> {
|
||||
wallet::is_valid_account_extfvk(self.conn.borrow(), &self.params, account, extfvk)
|
||||
}
|
||||
|
||||
fn get_wallet_summary(
|
||||
&self,
|
||||
min_confirmations: u32,
|
||||
|
|
|
@ -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<P: consensus::Parameters>(
|
|||
.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<P: consensus::Parameters>(
|
||||
conn: &rusqlite::Connection,
|
||||
params: &P,
|
||||
account: AccountId,
|
||||
extfvk: &ExtendedFullViewingKey,
|
||||
) -> Result<bool, SqliteClientError> {
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue