diff --git a/zcash_client_backend/src/data_api/error.rs b/zcash_client_backend/src/data_api/error.rs index 88357816f..fff7a730f 100644 --- a/zcash_client_backend/src/data_api/error.rs +++ b/zcash_client_backend/src/data_api/error.rs @@ -15,6 +15,7 @@ use zcash_primitives::{ zip32::AccountId, }; +use crate::data_api::PoolType; use crate::data_api::wallet::input_selection::InputSelectorError; #[cfg(feature = "transparent-inputs")] @@ -22,7 +23,7 @@ use zcash_primitives::{legacy::TransparentAddress, zip32::DiversifierIndex}; /// Errors that can occur as a consequence of wallet operations. #[derive(Debug)] -pub enum Error { +pub enum Error { /// An error occurred retrieving data from the underlying data source DataSource(DataSourceError), @@ -68,14 +69,13 @@ pub enum Error fmt::Display for Error +impl fmt::Display for Error where DE: fmt::Display, CE: fmt::Display, SE: fmt::Display, FE: fmt::Display, - N: fmt::Display, - PT: fmt::Display + N: fmt::Display { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match &self { @@ -134,14 +134,13 @@ where } } -impl error::Error for Error +impl error::Error for Error where DE: Debug + Display + error::Error + 'static, CE: Debug + Display + error::Error + 'static, SE: Debug + Display + error::Error + 'static, FE: Debug + Display + 'static, N: Debug + Display, - PT: Debug + Display { fn source(&self) -> Option<&(dyn error::Error + 'static)> { match &self { @@ -154,19 +153,19 @@ where } } -impl From> for Error { +impl From> for Error { fn from(e: builder::Error) -> Self { Error::Builder(e) } } -impl From for Error { +impl From for Error { fn from(e: BalanceError) -> Self { Error::BalanceError(e) } } -impl From> for Error { +impl From> for Error { fn from(e: InputSelectorError) -> Self { match e { InputSelectorError::DataSource(e) => Error::DataSource(e), @@ -183,19 +182,19 @@ impl From> for Error From for Error { +impl From for Error { fn from(e: sapling::builder::Error) -> Self { Error::Builder(builder::Error::SaplingBuild(e)) } } -impl From for Error { +impl From for Error { fn from(e: transparent::builder::Error) -> Self { Error::Builder(builder::Error::TransparentBuild(e)) } } -impl From> for Error { +impl From> for Error { fn from(e: ShardTreeError) -> Self { Error::CommitmentTree(e) } diff --git a/zcash_client_backend/src/data_api/wallet.rs b/zcash_client_backend/src/data_api/wallet.rs index f58fd0be2..ed8c3ec3c 100644 --- a/zcash_client_backend/src/data_api/wallet.rs +++ b/zcash_client_backend/src/data_api/wallet.rs @@ -207,7 +207,6 @@ pub fn create_spend_to_address( GreedyInputSelectorError, Infallible, DbT::NoteRef, - PoolType, >, > where @@ -311,7 +310,6 @@ pub fn spend( InputsT::Error, ::Error, DbT::NoteRef, - PoolType, >, > where @@ -366,7 +364,6 @@ pub fn propose_transfer( InputsT::Error, ::Error, DbT::NoteRef, - PoolType, >, > where @@ -450,7 +447,6 @@ pub fn create_proposed_transaction( InputsErrT, FeeRuleT::Error, DbT::NoteRef, - PoolType, >, > where @@ -496,7 +492,7 @@ where let checkpoint_depth = wallet_db.get_checkpoint_depth(min_confirmations)?; - wallet_db.with_sapling_tree_mut::<_, _, Error<_, _, _, _, _, _>>(|sapling_tree| { + wallet_db.with_sapling_tree_mut::<_, _, Error<_, _, _, _, _>>(|sapling_tree| { for selected in proposal.sapling_inputs() { let (note, key, merkle_path) = select_key_for_note( sapling_tree, diff --git a/zcash_client_sqlite/src/testing.rs b/zcash_client_sqlite/src/testing.rs index 0a2db28e7..386543c10 100644 --- a/zcash_client_sqlite/src/testing.rs +++ b/zcash_client_sqlite/src/testing.rs @@ -15,7 +15,7 @@ use tempfile::NamedTempFile; use tempfile::TempDir; use zcash_client_backend::data_api::chain::ScanSummary; -use zcash_client_backend::data_api::{AccountBalance, WalletRead, PoolType}; +use zcash_client_backend::data_api::{AccountBalance, WalletRead}; #[allow(deprecated)] use zcash_client_backend::{ address::RecipientAddress, @@ -446,7 +446,6 @@ impl TestState { GreedyInputSelectorError, Infallible, ReceivedNoteId, - PoolType, >, > { let params = self.network(); @@ -480,7 +479,6 @@ impl TestState { InputsT::Error, ::Error, ReceivedNoteId, - PoolType, >, > where @@ -515,7 +513,6 @@ impl TestState { InputsT::Error, ::Error, ReceivedNoteId, - PoolType, >, > where @@ -582,7 +579,6 @@ impl TestState { Infallible, FeeRuleT::Error, ReceivedNoteId, - PoolType, >, > where diff --git a/zcash_client_sqlite/src/wallet.rs b/zcash_client_sqlite/src/wallet.rs index 41ea48e0f..524d3431a 100644 --- a/zcash_client_sqlite/src/wallet.rs +++ b/zcash_client_sqlite/src/wallet.rs @@ -136,7 +136,7 @@ pub(crate) fn pool_code(pool_type: PoolType) -> i64 { match pool_type { PoolType::Transparent => 0i64, PoolType::Shielded(ShieldedProtocol::Sapling) => 2i64, - PoolType::Shielded(ShieldedProtocol::Orchard) => 4i64 + PoolType::Shielded(ShieldedProtocol::Orchard) => 3i64 } } diff --git a/zcash_client_sqlite/src/wallet/sapling.rs b/zcash_client_sqlite/src/wallet/sapling.rs index 83fb3e065..6bf84cf00 100644 --- a/zcash_client_sqlite/src/wallet/sapling.rs +++ b/zcash_client_sqlite/src/wallet/sapling.rs @@ -465,7 +465,7 @@ pub(crate) mod tests { error::Error, wallet::input_selection::{GreedyInputSelector, GreedyInputSelectorError}, AccountBirthday, Ratio, ShieldedProtocol, WalletCommitmentTrees, WalletRead, - WalletWrite, PoolType, + WalletWrite, }, decrypt_transaction, fees::{fixed, zip317, DustOutputPolicy}, @@ -983,7 +983,6 @@ pub(crate) mod tests { GreedyInputSelectorError, Infallible, ReceivedNoteId, - PoolType, >, > { let txid = st.create_spend_to_address(