pub struct Step<NoteRef> { /* private fields */ }Expand description
The inputs to be consumed and outputs to be produced in a proposed transaction.
Implementations§
Source§impl<NoteRef> Step<NoteRef>
impl<NoteRef> Step<NoteRef>
Sourcepub fn from_parts(
prior_steps: &[Step<NoteRef>],
transaction_request: TransactionRequest,
payment_pools: BTreeMap<usize, PoolType>,
transparent_inputs: Vec<WalletTransparentOutput<()>>,
shielded_inputs: Option<ShieldedInputs<NoteRef>>,
anchor_height: Option<BlockHeight>,
prior_step_inputs: Vec<StepOutput>,
balance: TransactionBalance,
is_shielding: bool,
ironwood_active: bool,
) -> Result<Self, ProposalError>
pub fn from_parts( prior_steps: &[Step<NoteRef>], transaction_request: TransactionRequest, payment_pools: BTreeMap<usize, PoolType>, transparent_inputs: Vec<WalletTransparentOutput<()>>, shielded_inputs: Option<ShieldedInputs<NoteRef>>, anchor_height: Option<BlockHeight>, prior_step_inputs: Vec<StepOutput>, balance: TransactionBalance, is_shielding: bool, ironwood_active: bool, ) -> Result<Self, ProposalError>
Constructs a validated Step from its constituent parts.
This operation validates the proposal for balance consistency and agreement between
the is_shielding flag and the structure of the proposal.
Parameters:
transaction_request: The ZIP 321 transaction request describing the payments to be made.payment_pools: A map from payment index to pool type. The set of payment indices provided here must exactly match the set of payment indices in theTransactionRequest, and the selected pool for an index must correspond to a valid receiver of the address at that index (or the address itself in the case of bare transparent or Sapling addresses).transparent_inputs: The set of previous transparent outputs to be spent.shielded_inputs: The sets of previous shielded outputs to be spent.anchor_height: The anchor height that binds every shielded-tree lookup performed while building this step’s transaction — both shielded-input witnesses and shielded-output anchors. A step that produces a shielded bundle (spends shielded notes, pays to a shielded pool, or returns shielded change) must provideSome; only a purely transparent step may passNone.balance: The change outputs to be added the transaction and the fee to be paid.is_shielding: A flag that identifies whether this is a wallet-internal shielding transaction.ironwood_active: Whether the Ironwood pool is active at the target height for which this step is proposed. When active, the step is checked against the Orchard turnstile: no payment may be directed to the Orchard pool, and change may be returned to it only when strictly less value returns than the step’s Orchard inputs remove.
Sourcepub fn transaction_request(&self) -> &TransactionRequest
pub fn transaction_request(&self) -> &TransactionRequest
Returns the transaction request that describes the payments to be made.
Sourcepub fn payment_pools(&self) -> &BTreeMap<usize, PoolType>
pub fn payment_pools(&self) -> &BTreeMap<usize, PoolType>
Returns the map from payment index to the pool that has been selected for the output that will fulfill that payment.
Sourcepub fn transparent_inputs(&self) -> &[WalletTransparentOutput<()>]
pub fn transparent_inputs(&self) -> &[WalletTransparentOutput<()>]
Returns the transparent inputs that have been selected to fund the transaction.
Sourcepub fn shielded_inputs(&self) -> Option<&ShieldedInputs<NoteRef>>
pub fn shielded_inputs(&self) -> Option<&ShieldedInputs<NoteRef>>
Returns the shielded inputs that have been selected to fund the transaction.
Sourcepub fn anchor_height(&self) -> Option<BlockHeight>
pub fn anchor_height(&self) -> Option<BlockHeight>
Returns the anchor height that binds every shielded-tree lookup performed while building
this step’s transaction, or None for a purely transparent step that performs no such
lookup.
Sourcepub fn prior_step_inputs(&self) -> &[StepOutput]
pub fn prior_step_inputs(&self) -> &[StepOutput]
Returns the inputs that should be obtained from the outputs of the transaction created to satisfy a previous step of the proposal.
Sourcepub fn balance(&self) -> &TransactionBalance
pub fn balance(&self) -> &TransactionBalance
Returns the change outputs to be added to the transaction and the fee to be paid.
Sourcepub fn is_shielding(&self) -> bool
pub fn is_shielding(&self) -> bool
Returns a flag indicating whether or not the proposed transaction is exclusively wallet-internal (if it does not involve any external recipients).
Sourcepub fn involves(&self, pool_type: PoolType) -> bool
pub fn involves(&self, pool_type: PoolType) -> bool
Returns whether or not this proposal requires interaction with the specified pool.
Sourcepub fn input_in_pool(&self, pool_type: PoolType) -> bool
pub fn input_in_pool(&self, pool_type: PoolType) -> bool
Returns whether or not this step spends any inputs from the given pool.
For a shielded pool this is true when a note of that protocol is spent; for
[PoolType::Transparent] it is true when the step is a shielding step or has any
transparent inputs.
Sourcepub fn output_in_pool(&self, pool_type: PoolType) -> bool
pub fn output_in_pool(&self, pool_type: PoolType) -> bool
Returns whether or not this step directs any payment output to the given pool.
This does not consider change outputs; use Step::change_in_pool for those.
Sourcepub fn change_in_pool(&self, pool_type: PoolType) -> bool
pub fn change_in_pool(&self, pool_type: PoolType) -> bool
Returns whether or not this step directs any change output to the given pool.
Sourcepub fn input_count_in_pool(&self, pool_type: PoolType) -> usize
pub fn input_count_in_pool(&self, pool_type: PoolType) -> usize
Returns the number of inputs to this step that belong to the given pool.
For a shielded pool this is the number of spent notes of that protocol; for
[PoolType::Transparent] it is the number of transparent inputs.
Sourcepub fn output_count_in_pool(&self, pool_type: PoolType) -> usize
pub fn output_count_in_pool(&self, pool_type: PoolType) -> usize
Returns the number of payment outputs of this step that are directed to the given pool.
This does not include change outputs; use Step::change_count_in_pool for those.
Sourcepub fn change_count_in_pool(&self, pool_type: PoolType) -> usize
pub fn change_count_in_pool(&self, pool_type: PoolType) -> usize
Returns the number of change outputs of this step that are directed to the given pool.
Sourcepub fn is_canonical_crossing<P: PoolMigrationConstants>(
&self,
params: &P,
canonical_fee: Zatoshis,
) -> bool
Available on crate feature orchard only.
pub fn is_canonical_crossing<P: PoolMigrationConstants>( &self, params: &P, canonical_fee: Zatoshis, ) -> bool
orchard only.Returns whether this step is a canonical crossing: a step whose whole shape is
indistinguishable from a ZIP 318 migration transfer, and which is therefore built with a
single unpadded Ironwood action so that it joins that anonymity set. See
Step::ironwood_bundle_padding.
A migration transfer spends one Orchard note, pads its Orchard bundle to the default two-action floor (the spend plus its change, or a dummy when the note’s value exactly covers the crossing and its fee), outputs one canonical denomination into the Ironwood pool, and is proved against a boundary of the anchor bucket grid. Every one of those is required here:
- exactly one Orchard input and at most one Orchard change output, so that the Orchard bundle is exactly two actions;
- no change in any other pool;
- no Ironwood spends, a step funded from Ironwood crossing nothing;
- no Ironwood change, leaving a single Ironwood output;
- that output’s value is a canonical denomination under
params; - the step’s anchor lies on
params’ anchor bucket grid; - the fee equals
canonical_fee, which the caller obtains fromfees::canonical_crossing_feefor the consensus parameters and target height the transaction will actually be built against.
Dropping the Ironwood padding without the rest would not buy anonymity but destroy it: an unpadded Ironwood bundle beside an Orchard bundle of the wrong size, or against a chain-tip anchor, is a shape nothing else on the network emits — a fingerprint rather than a disguise.
Sourcepub fn ironwood_bundle_padding(&self) -> BundlePadding
Available on crate feature orchard only.
pub fn ironwood_bundle_padding(&self) -> BundlePadding
orchard only.The transactional bundle padding the transaction builder must use for this step’s Ironwood
bundle: the padding the ChangeStrategy recorded when it computed the fee.
This is READ, not re-derived. The builder must produce exactly the action count the fee was charged against, and a second derivation could disagree with the first — which is precisely what happens for a condition only one of them can evaluate, such as whether the resulting fee is itself canonical.
Sourcepub fn orchard_action_count(
&self,
padding: BundlePadding,
bundle_version: BundleVersion,
) -> Result<usize, &'static str>
Available on crate feature orchard only.
pub fn orchard_action_count( &self, padding: BundlePadding, bundle_version: BundleVersion, ) -> Result<usize, &'static str>
orchard only.Returns the number of actions the transaction builder will produce for this step’s Orchard-pool bundle, given the bundle padding and version it will be configured with.
The count depends upon the bundle version: prior to NU6.3, an action may carry both a
spend and an output, so a bundle requires max(spends, outputs) actions; from NU6.3
onwards the Orchard pool disables cross-address transfers, and each requested spend and
output is instead paired with a fabricated zero-valued counterpart, so a bundle requires
spends + outputs actions. The padding determines the floor applied on top of that count.
The caller must pass the same padding and version the transaction builder will be
configured with, otherwise the count will not match the bundle that is built.
bundle_version_for_branch returns the version applicable to a given consensus branch
and pool. The Orchard bundle is always padded to the default floor; only the Ironwood
bundle’s padding varies, and Step::ironwood_bundle_padding derives it.
A step describes a wallet spend, which is never a coinbase transaction, so this takes a
[BundlePadding] rather than a full bundle type: coinbase construction is a property of the
whole transaction and is not representable here.
§Errors
Returns an error if this step’s Orchard spend and output counts are incompatible with the given padding and version.
Sourcepub fn ironwood_action_count(
&self,
padding: BundlePadding,
bundle_version: BundleVersion,
) -> Result<usize, &'static str>
Available on crate feature orchard only.
pub fn ironwood_action_count( &self, padding: BundlePadding, bundle_version: BundleVersion, ) -> Result<usize, &'static str>
orchard only.Returns the number of actions the transaction builder will produce for this step’s Ironwood-pool bundle, given the bundle padding and version it will be configured with.
See Step::orchard_action_count for how the count is determined; the Ironwood pool
permits cross-address transfers, so an Ironwood bundle requires
max(spends, outputs) actions before padding.
§Errors
Returns an error if this step’s Ironwood spend and output counts are incompatible with the given padding and version.
Trait Implementations§
impl<NoteRef: Eq> Eq for Step<NoteRef>
impl<NoteRef: PartialEq> StructuralPartialEq for Step<NoteRef>
Auto Trait Implementations§
impl<NoteRef> Freeze for Step<NoteRef>
impl<NoteRef> RefUnwindSafe for Step<NoteRef>
impl<NoteRef> Send for Step<NoteRef>
impl<NoteRef> Sync for Step<NoteRef>
impl<NoteRef> Unpin for Step<NoteRef>
impl<NoteRef> UnsafeUnpin for Step<NoteRef>
impl<NoteRef> UnwindSafe for Step<NoteRef>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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].§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.