pub struct FixedNotes { /* private fields */ }test-dependencies only.Expand description
An InputSource holding a fixed list of shielded notes, for tests that drive input
selection without a wallet database.
Selection takes the notes in the order given, within the pools asked for, until the target
value is reached. Unlike zcash_client_sqlite, it does not withhold notes at or below the
marginal fee. Every note is spendable by any account, and every account can receive change
in every shielded pool and has no transparent receiver. The selection methods,
InputSource::select_unspent_notes and InputSource::get_change_receivers are
implemented; every other operation returns FixedNotesError::Unsupported.
Implementations§
Source§impl FixedNotes
impl FixedNotes
Sourcepub fn new(notes: &[(ShieldedPool, u32, Zatoshis)]) -> Self
pub fn new(notes: &[(ShieldedPool, u32, Zatoshis)]) -> Self
Holds one note per entry, given as its pool, identifier and value in selection order. Each note is received at its own output index of a single transaction.
§Panics
When the notes’ total value exceeds the monetary range, when there are more notes than
a u16 output index can number, and without the orchard feature on an Orchard or
Ironwood entry.
Sourcepub fn ignoring_sources(self) -> Self
pub fn ignoring_sources(self) -> Self
Returns the source with the sources argument of the selection methods ignored, so
that it returns notes from pools it was not asked for, breaking the contract of
InputSource.
Sourcepub fn ignoring_exclude(self) -> Self
pub fn ignoring_exclude(self) -> Self
Returns the source with the exclude argument of the selection methods ignored, so
that it returns excluded notes, breaking the contract of InputSource.
Sourcepub fn with_selection_limit(self, limit: usize) -> Self
pub fn with_selection_limit(self, limit: usize) -> Self
Returns the source failing with FixedNotesError::SelectionLimitReached past limit
calls to InputSource::select_spendable_notes, so that a test of input selection’s
termination fails instead of hanging.
Trait Implementations§
Source§impl InputSource for FixedNotes
impl InputSource for FixedNotes
Source§type Error = FixedNotesError
type Error = FixedNotesError
Source§fn get_spendable_note(
&self,
_txid: &TxId,
_protocol: ShieldedPool,
_index: u32,
_target_height: TargetHeight,
_lock_filter: LockFilter<'_>,
) -> Result<Option<ReceivedNote<Self::NoteRef, Note>>, Self::Error>
fn get_spendable_note( &self, _txid: &TxId, _protocol: ShieldedPool, _index: u32, _target_height: TargetHeight, _lock_filter: LockFilter<'_>, ) -> Result<Option<ReceivedNote<Self::NoteRef, Note>>, Self::Error>
Source§fn anchor_computable(
&self,
_protocol: ShieldedPool,
_height: BlockHeight,
) -> Result<bool, Self::Error>
fn anchor_computable( &self, _protocol: ShieldedPool, _height: BlockHeight, ) -> Result<bool, Self::Error>
height for spends from the given pool: whether
this data source can produce the note commitment tree root, and witnesses to it, as of the
end of that block. Read moreSource§fn select_spendable_notes(
&self,
_account: Self::AccountId,
target_value: TargetValue,
sources: &[ShieldedPool],
_target_height: TargetHeight,
_confirmations_policy: ConfirmationsPolicy,
exclude: &[Self::NoteRef],
_lock_filter: LockFilter<'_>,
) -> Result<ReceivedNotes<Self::NoteRef>, Self::Error>
fn select_spendable_notes( &self, _account: Self::AccountId, target_value: TargetValue, sources: &[ShieldedPool], _target_height: TargetHeight, _confirmations_policy: ConfirmationsPolicy, exclude: &[Self::NoteRef], _lock_filter: LockFilter<'_>, ) -> Result<ReceivedNotes<Self::NoteRef>, Self::Error>
sources will be included, and a
note in exclude is never returned. Locked outputs are selected according to
lock_filter (see LockFilter; a LockFilter::Policy carrying the default
Exclude selects none).Source§fn select_unspent_notes(
&self,
_account: Self::AccountId,
sources: &[ShieldedPool],
_target_height: TargetHeight,
exclude: &[Self::NoteRef],
_lock_filter: LockFilter<'_>,
) -> Result<ReceivedNotes<Self::NoteRef>, Self::Error>
fn select_unspent_notes( &self, _account: Self::AccountId, sources: &[ShieldedPool], _target_height: TargetHeight, exclude: &[Self::NoteRef], _lock_filter: LockFilter<'_>, ) -> Result<ReceivedNotes<Self::NoteRef>, Self::Error>
lock_filter (see LockFilter;
a LockFilter::Policy carrying the default Exclude selects none).Source§fn get_change_receivers(
&self,
_account: Self::AccountId,
) -> Result<ChangeReceivers, Self::Error>
fn get_change_receivers( &self, _account: Self::AccountId, ) -> Result<ChangeReceivers, Self::Error>
Source§fn get_account_metadata(
&self,
_account: Self::AccountId,
_selector: &NoteFilter,
_target_height: TargetHeight,
_exclude: &[Self::NoteRef],
_lock_filter: LockFilter<'_>,
) -> Result<AccountMeta, Self::Error>
fn get_account_metadata( &self, _account: Self::AccountId, _selector: &NoteFilter, _target_height: TargetHeight, _exclude: &[Self::NoteRef], _lock_filter: LockFilter<'_>, ) -> Result<AccountMeta, Self::Error>
Source§fn select_single_spendable_note(
&self,
account: Self::AccountId,
value: Zatoshis,
sources: &[ShieldedPool],
target_height: TargetHeight,
confirmations_policy: ConfirmationsPolicy,
exclude: &[Self::NoteRef],
lock_filter: LockFilter<'_>,
) -> Result<ReceivedNotes<Self::NoteRef>, Self::Error>
fn select_single_spendable_note( &self, account: Self::AccountId, value: Zatoshis, sources: &[ShieldedPool], target_height: TargetHeight, confirmations_policy: ConfirmationsPolicy, exclude: &[Self::NoteRef], lock_filter: LockFilter<'_>, ) -> Result<ReceivedNotes<Self::NoteRef>, Self::Error>
value, drawn
from the first pool in sources (in the given preference order) that holds one. A note
in exclude is never returned. The returned collection contains at most one note; it is
empty when no single eligible note covers the value. Read moreSource§fn get_unspent_transparent_output(
&self,
_outpoint: &OutPoint,
_target_height: TargetHeight,
) -> Result<Option<WalletTransparentOutput<Self::AccountId>>, Self::Error>
fn get_unspent_transparent_output( &self, _outpoint: &OutPoint, _target_height: TargetHeight, ) -> Result<Option<WalletTransparentOutput<Self::AccountId>>, Self::Error>
transparent-inputs only.outpoint if it is considered
spendable as of the provided target_height. Read moreSource§fn get_spendable_transparent_outputs(
&self,
_address: &TransparentAddress,
_target_height: TargetHeight,
_confirmations_policy: ConfirmationsPolicy,
_output_filter: CoinbaseFilter,
_lock_filter: LockFilter<'_>,
) -> Result<Vec<WalletTransparentOutput<Self::AccountId>>, Self::Error>
fn get_spendable_transparent_outputs( &self, _address: &TransparentAddress, _target_height: TargetHeight, _confirmations_policy: ConfirmationsPolicy, _output_filter: CoinbaseFilter, _lock_filter: LockFilter<'_>, ) -> Result<Vec<WalletTransparentOutput<Self::AccountId>>, Self::Error>
transparent-inputs only.address
such that, at height target_height: Read moreSource§fn get_spendable_transparent_outputs_for_addresses(
&self,
addresses: &[TransparentAddress],
target_height: TargetHeight,
confirmations_policy: ConfirmationsPolicy,
output_filter: CoinbaseFilter,
lock_filter: LockFilter<'_>,
) -> Result<Vec<WalletTransparentOutput<Self::AccountId>>, Self::Error>
fn get_spendable_transparent_outputs_for_addresses( &self, addresses: &[TransparentAddress], target_height: TargetHeight, confirmations_policy: ConfirmationsPolicy, output_filter: CoinbaseFilter, lock_filter: LockFilter<'_>, ) -> Result<Vec<WalletTransparentOutput<Self::AccountId>>, Self::Error>
transparent-inputs only.addresses, subject to the same spendability conditions as
InputSource::get_spendable_transparent_outputs. Read moreSource§fn select_spendable_transparent_outputs(
&self,
account: Self::AccountId,
target_height: TargetHeight,
confirmations_policy: ConfirmationsPolicy,
output_filter: CoinbaseFilter,
address_allow_list: Option<&[TransparentAddress]>,
target_value: TargetValue,
max_inputs: usize,
fee_rule: &StandardFeeRule,
lock_filter: LockFilter<'_>,
) -> Result<Vec<WalletTransparentOutput<Self::AccountId>>, Self::Error>
fn select_spendable_transparent_outputs( &self, account: Self::AccountId, target_height: TargetHeight, confirmations_policy: ConfirmationsPolicy, output_filter: CoinbaseFilter, address_allow_list: Option<&[TransparentAddress]>, target_value: TargetValue, max_inputs: usize, fee_rule: &StandardFeeRule, lock_filter: LockFilter<'_>, ) -> Result<Vec<WalletTransparentOutput<Self::AccountId>>, Self::Error>
transparent-inputs only.account whose total post-fee
value (sum of values minus the cumulative marginal fee cost of the gathered inputs
themselves, per fee_rule) is at least target_value, or max_inputs outputs
(whichever is reached first). Read moreAuto Trait Implementations§
impl !Freeze for FixedNotes
impl !RefUnwindSafe for FixedNotes
impl !Sync for FixedNotes
impl Send for FixedNotes
impl Unpin for FixedNotes
impl UnsafeUnpin for FixedNotes
impl UnwindSafe for FixedNotes
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].Source§impl<I> MetaSource for Iwhere
I: InputSource,
impl<I> MetaSource for Iwhere
I: InputSource,
type Error = <I as InputSource>::Error
type AccountId = <I as InputSource>::AccountId
type NoteRef = <I as InputSource>::NoteRef
Source§fn change_receivers(
&self,
account: <I as InputSource>::AccountId,
) -> Result<ChangeReceivers, <I as InputSource>::Error>
fn change_receivers( &self, account: <I as InputSource>::AccountId, ) -> Result<ChangeReceivers, <I as InputSource>::Error>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PossiblyOption<T> for T
impl<T> PossiblyOption<T> for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.