`zcash_client_sqlite`: Add `TestState::propose_shielding`

Currently unused (causing an expected lint), but will be in an upcoming PR.
This commit is contained in:
Jack Grigg 2023-08-28 18:58:37 +00:00
parent 578eac15df
commit 8af74de931
1 changed files with 33 additions and 1 deletions

View File

@ -55,7 +55,7 @@ use zcash_primitives::{
}; };
#[cfg(feature = "transparent-inputs")] #[cfg(feature = "transparent-inputs")]
use zcash_client_backend::data_api::wallet::shield_transparent_funds; use zcash_client_backend::data_api::wallet::{propose_shielding, shield_transparent_funds};
#[cfg(feature = "transparent-inputs")] #[cfg(feature = "transparent-inputs")]
use zcash_primitives::{ use zcash_primitives::{
legacy, legacy::keys::IncomingViewingKey, transaction::components::amount::NonNegativeAmount, legacy, legacy::keys::IncomingViewingKey, transaction::components::amount::NonNegativeAmount,
@ -422,6 +422,38 @@ impl<Cache> TestState<Cache> {
) )
} }
/// Invokes [`propose_shielding`] with the given arguments.
#[cfg(feature = "transparent-inputs")]
#[allow(clippy::type_complexity)]
pub(crate) fn propose_shielding<InputsT>(
&mut self,
input_selector: &InputsT,
shielding_threshold: NonNegativeAmount,
from_addrs: &[TransparentAddress],
min_confirmations: NonZeroU32,
) -> Result<
Proposal<InputsT::FeeRule, ReceivedNoteId>,
data_api::error::Error<
SqliteClientError,
Infallible,
InputsT::Error,
<InputsT::FeeRule as FeeRule>::Error,
ReceivedNoteId,
>,
>
where
InputsT: InputSelector<DataSource = WalletDb<Connection, Network>>,
{
propose_shielding::<_, _, _, Infallible>(
&mut self.db_data,
&self.params,
input_selector,
shielding_threshold,
from_addrs,
min_confirmations,
)
}
/// Invokes [`create_proposed_transaction`] with the given arguments. /// Invokes [`create_proposed_transaction`] with the given arguments.
pub(crate) fn create_proposed_transaction<FeeRuleT>( pub(crate) fn create_proposed_transaction<FeeRuleT>(
&mut self, &mut self,