Skip to main content

Transaction

Struct Transaction 

Source
pub struct Transaction(pub(crate) Transaction);
Expand description

A Zcash transaction, wrapping zcash_primitives::transaction::Transaction.

Tuple Fields§

§0: Transaction

Implementations§

Source§

impl Transaction

Source

pub fn v1_strategy(ledger_state: LedgerState) -> BoxedStrategy<Self>

Generate a proptest strategy for V1 Transactions

Source

pub fn v2_strategy(ledger_state: LedgerState) -> BoxedStrategy<Self>

Generate a proptest strategy for V2 Transactions

Note: the new Transaction type doesn’t support arbitrary Sprout JoinSplit data in proptest strategies, so this generates transparent-only V2 transactions.

Source

pub fn v3_strategy(ledger_state: LedgerState) -> BoxedStrategy<Self>

Generate a proptest strategy for V3 Transactions

Note: the new Transaction type doesn’t support arbitrary Sprout JoinSplit data in proptest strategies, so this generates transparent-only V3 transactions.

Source

pub fn v4_strategy(ledger_state: LedgerState) -> BoxedStrategy<Self>

Generate a proptest strategy for V4 Transactions

Note: the new Transaction type doesn’t support arbitrary Sapling/Sprout shielded data in proptest strategies, so this generates transparent-only V4 transactions.

Source

pub fn v5_strategy(ledger_state: LedgerState) -> BoxedStrategy<Self>

Generate a proptest strategy for V5 Transactions

Note: the new Transaction type doesn’t support arbitrary Sapling/Orchard shielded data in proptest strategies, so this generates transparent-only V5 transactions.

Source

pub fn v6_strategy(ledger_state: LedgerState) -> BoxedStrategy<Self>

Generate a proptest strategy for V6 Transactions

Note: like Self::v5_strategy, the new Transaction type doesn’t support arbitrary shielded data in proptest strategies, so this generates transparent-only V6 transactions.

Source

pub fn vec_strategy( ledger_state: LedgerState, len: usize, ) -> BoxedStrategy<Vec<Arc<Self>>>

Proptest Strategy for creating a Vector of transactions where the first transaction is always the only coinbase transaction

Source

pub fn for_each_value_mut<F>(&mut self, f: F)
where F: FnMut(&mut Amount<NonNegative>),

Apply f to the transparent output values in this transaction.

Note: Sprout/sapling/orchard value mutations are not supported with the new Transaction type (proptest strategies generate transparent-only txs).

Source

pub fn for_each_value_balance_mut<F>(&mut self, _f: F)
where F: FnMut(&mut Amount<NegativeAllowed>),

Apply f to the sapling value balance and orchard value balance.

Note: Not implemented for the new Transaction type since proptest strategies generate transparent-only transactions. This is a no-op.

Source

pub fn fix_overflow(&mut self)

Fixup transparent values and shielded value balances, so that transaction and chain value pools won’t overflow MAX_MONEY.

These fixes are applied to coinbase and non-coinbase transactions.

Source

pub fn fix_chain_value_pools( &mut self, chain_value_pools: ValueBalance<NonNegative>, outputs: &HashMap<OutPoint, Output>, ) -> Result<(Amount<NonNegative>, ValueBalance<NonNegative>), ValueBalanceError>

Fixup transparent values and shielded value balances, so that this transaction passes the “non-negative chain value pool” checks. (These checks use the sum of unspent outputs for each transparent and shielded pool.)

These fixes are applied to coinbase and non-coinbase transactions.

chain_value_pools contains the chain value pool balances, as of the previous transaction in this block (or the last transaction in the previous block).

outputs must contain all the transparent::Outputs spent in this transaction.

Currently, these fixes almost always leave some remaining value in each transparent and shielded chain value pool.

Before fixing the chain value balances, this method calls fix_overflow to make sure that transaction and chain value pools don’t overflow MAX_MONEY.

After fixing the chain value balances, this method calls fix_remaining_value to fix the remaining value in the transaction value pool.

Returns the remaining transaction value, and the updated chain value balances.

§Panics

If any spent transparent::Output is missing from transparent::OutPoints.

Source

fn input_value_pool( &self, outputs: &HashMap<OutPoint, Output>, ) -> Result<Amount<NonNegative>, ValueBalanceError>

Returns the total input value of this transaction’s value pool.

This is the sum of transparent inputs, sprout input values, and if positive, the sapling, orchard, and ironwood value balances.

outputs must contain all the transparent::Outputs spent in this transaction.

Source

pub fn fix_remaining_value( &mut self, outputs: &HashMap<OutPoint, Output>, ) -> Result<Amount<NonNegative>, ValueBalanceError>

Fixup non-coinbase transparent values and shielded value balances, so that this transaction passes the “non-negative remaining transaction value” check. (This check uses the sum of inputs minus outputs.)

Returns the remaining transaction value.

outputs must contain all the transparent::Outputs spent in this transaction.

Currently, these fixes almost always leave some remaining value in the transaction value pool.

§Panics

If any spent transparent::Output is missing from transparent::OutPoints.

Source§

impl Transaction

Source

pub(crate) fn inner(&self) -> &Transaction

Access the inner zcash_primitives::transaction::Transaction.

Source

pub fn tx_version(&self) -> TxVersion

Returns the transaction version.

Source

pub fn version(&self) -> u32

Returns the numeric version of this transaction.

Source

pub fn is_overwintered(&self) -> bool

Returns true if this is an overwinter or later transaction.

Source

pub fn network_upgrade(&self) -> Option<NetworkUpgrade>

Get the network upgrade for this transaction, if any (V5+).

Source

pub fn sighash( &self, network_upgrade: NetworkUpgrade, hash_type: HashType, all_previous_outputs: Arc<Vec<Output>>, input_index_script_code: Option<(usize, Vec<u8>)>, ) -> Result<SigHash, Error>

Compute the sighash for this transaction.

Returns an error if network_upgrade doesn’t match the transaction’s consensus branch ID.

Source

pub fn sighasher( &self, network_upgrade: NetworkUpgrade, all_previous_outputs: Arc<Vec<Output>>, ) -> Result<SigHasher, Error>

Returns a SigHasher for this transaction.

Returns an error if network_upgrade doesn’t match the transaction’s consensus branch ID.

Source

pub fn lock_time(&self) -> Option<LockTime>

Get this transaction’s lock time.

Source

pub fn raw_lock_time(&self) -> u32

Get the raw lock time value as a u32.

Source

pub fn lock_time_is_time(&self) -> bool

Returns true if lock_time is a LockTime::Time and is not disabled by sequence numbers.

Source

pub fn expiry_height(&self) -> Option<Height>

Get the expiry height for this transaction, if any (V3+).

Returns None if the transaction is Sprout, or if nExpiryHeight == 0 (which means “no expiry” per the Zcash protocol spec).

Returns the raw wire value, which can exceed block::Height::MAX: the ZIP-203 maximum of 499,999,999 is a verifier rule, not a limit of this accessor, so an out-of-range value must reach the verifier to be rejected.

Source

pub fn version_group_id(&self) -> Option<u32>

Get the version group ID for this transaction, if any.

Source

pub fn inputs(&self) -> Vec<Input>

Get the transparent inputs, converted to Zebra types.

Source

pub fn outputs(&self) -> Vec<Output>

Get the transparent outputs, converted to Zebra types.

Source

pub fn has_transparent_inputs(&self) -> bool

Returns true if this transaction has transparent inputs.

Source

pub fn has_transparent_outputs(&self) -> bool

Returns true if this transaction has transparent outputs.

Source

pub fn has_transparent_inputs_or_outputs(&self) -> bool

Returns true if this transaction has transparent inputs or outputs.

Source

pub fn is_coinbase(&self) -> bool

Returns true if this is a coinbase transaction.

Source

pub fn is_valid_non_coinbase(&self) -> bool

Returns true if this transaction has valid inputs for a non-coinbase transaction, that is, none of its transparent inputs has a null prevout.

§Consensus

A transparent input in a non-coinbase transaction MUST NOT have a null prevout.

https://zips.z.cash/protocol/protocol.pdf#txnconsensus

Note that a transaction can return false from both Transaction::is_coinbase and this method, for example a transaction with a null-prevout input alongside other inputs. Such transactions are rejected by the verifier.

Source

pub fn spent_outpoints(&self) -> impl Iterator<Item = OutPoint> + '_

Returns the outpoints spent by this transaction’s transparent inputs.

Source

pub fn hash(&self) -> Hash

Compute the hash (txid) of this transaction.

Source

pub fn auth_digest(&self) -> Option<AuthDigest>

Compute the authorizing data commitment for this transaction.

Returns None for pre-V5 transactions (which don’t have auth digests).

Source

pub fn unmined_id(&self) -> UnminedTxId

Compute the unmined transaction ID for this transaction.

Source

pub fn joinsplit_count(&self) -> usize

Returns the number of JoinSplit descriptions in this transaction.

Source

pub fn has_sprout_joinsplit_data(&self) -> bool

Returns true if this transaction has Sprout JoinSplit data.

Source

pub fn sprout_joinsplit_descriptions( &self, ) -> impl Iterator<Item = &JsDescription> + '_

Iterate over the Sprout JoinSplit descriptions (librustzcash type).

Source

pub fn sprout_nullifiers(&self) -> impl Iterator<Item = Nullifier> + '_

Access the Sprout nullifiers in this transaction.

Source

pub fn sprout_note_commitments( &self, ) -> impl Iterator<Item = NoteCommitment> + '_

Access the Sprout note commitments in this transaction.

Source

pub fn output_values_to_sprout(&self) -> Vec<i64>

Returns vpub_old values (amounts entering the Sprout pool).

Source

pub fn input_values_from_sprout(&self) -> Vec<i64>

Returns vpub_new values (amounts leaving the Sprout pool).

Source

pub fn sprout_joinsplit_pub_key(&self) -> Option<VerificationKeyBytes>

Access the JoinSplit public validating key, if any.

Source

pub fn has_sapling_shielded_data(&self) -> bool

Returns true if this transaction has Sapling shielded data.

Source

pub fn sapling_nullifiers(&self) -> impl Iterator<Item = Nullifier> + '_

Access the Sapling nullifiers in this transaction.

Source

pub fn sapling_spends( &self, ) -> impl Iterator<Item = &SpendDescription<Authorized>> + '_

Access the Sapling spend descriptions (librustzcash type).

The spend description type uses GrothProofBytes for proofs and redjubjub::Signature<SpendAuth> for auth sigs.

Source

pub fn sapling_spends_count(&self) -> usize

Returns the number of Sapling spends.

Source

pub fn sapling_outputs( &self, ) -> impl Iterator<Item = &OutputDescription<GrothProofBytes>> + '_

Access the Sapling output descriptions (librustzcash type).

Source

pub fn sapling_note_commitments( &self, ) -> impl Iterator<Item = ExtractedNoteCommitment> + '_

Access the Sapling note commitments in this transaction.

Source

pub fn sapling_anchors(&self) -> Vec<Root>

Iterate over deduplicated Sapling anchors as zebra tree roots.

Source

pub fn sapling_value_balance(&self) -> ValueBalance<NegativeAllowed>

Get the Sapling value balance.

Source

pub fn has_orchard_shielded_data(&self) -> bool

Returns true if this transaction has Orchard shielded data.

Source

pub fn orchard_nullifiers(&self) -> impl Iterator<Item = Nullifier> + '_

Access the Orchard nullifiers in this transaction.

Source

pub fn orchard_actions( &self, ) -> impl Iterator<Item = &Action<<Authorized as Authorization>::SpendAuth>> + '_

Access the Orchard actions (librustzcash type).

Source

pub fn orchard_note_commitments( &self, ) -> impl Iterator<Item = ExtractedNoteCommitment> + '_

Access Orchard note commitments.

Source

pub fn orchard_flags(&self) -> Option<Flags>

Access the Orchard flags, if any.

Source

pub fn orchard_anchor(&self) -> Option<Root>

Access the Orchard anchor as a zebra tree root, if any.

Source

pub fn orchard_value_balance(&self) -> ValueBalance<NegativeAllowed>

Get the Orchard value balance.

Source

pub fn has_ironwood_shielded_data(&self) -> bool

Returns true if this transaction has an Ironwood bundle.

Source

pub fn ironwood_nullifiers(&self) -> impl Iterator<Item = Nullifier> + '_

Access the Ironwood nullifiers in this transaction.

Source

pub fn ironwood_actions( &self, ) -> impl Iterator<Item = &Action<<Authorized as Authorization>::SpendAuth>> + '_

Access the Ironwood actions (librustzcash type).

Source

pub fn ironwood_note_commitments( &self, ) -> impl Iterator<Item = ExtractedNoteCommitment> + '_

Access Ironwood note commitments.

Source

pub fn ironwood_flags(&self) -> Option<Flags>

Access the Ironwood flags, if any.

Source

pub fn ironwood_anchor(&self) -> Option<Root>

Access the Ironwood anchor as a zebra tree root, if any.

Source

pub fn has_enough_ironwood_flags(&self) -> bool

Returns true unless this transaction has an Ironwood bundle that enables neither spends nor outputs.

Source

pub fn ironwood_value_balance(&self) -> ValueBalance<NegativeAllowed>

Get the Ironwood value balance.

Positive values are added to this transaction’s value pool, and removed from the Ironwood chain value pool. Negative values are removed from this transaction, and added to the Ironwood pool. This is zero for transactions without an Ironwood bundle.

https://zebra.zfnd.org/dev/rfcs/0012-value-pools.html#definitions

Source

pub fn orchard_proof_size_is_canonical(&self) -> bool

Returns true if the Orchard bundle’s Halo2 proof has the canonical size for its action count, or if there is no Orchard bundle.

A proof that is present but not canonically sized can be padded with arbitrary trailing data without affecting its validity (GHSA-jfw5-j458-pfv6). Bundles are deserialized leniently, so this is checked by the verifier rather than during parsing.

Source

pub fn ironwood_proof_size_is_canonical(&self) -> bool

Returns true if the Ironwood bundle’s Halo2 proof has the canonical size for its action count, or if there is no Ironwood bundle.

See Self::orchard_proof_size_is_canonical; Ironwood reuses the Orchard circuit, so it has the same expected proof size.

Source

pub fn has_shielded_inputs(&self) -> bool

Returns true if this transaction has shielded inputs.

Source

pub fn has_shielded_outputs(&self) -> bool

Returns true if this transaction has shielded outputs.

Source

pub fn has_shielded_data(&self) -> bool

Does this transaction have shielded inputs or outputs?

Source

pub fn has_transparent_or_shielded_inputs(&self) -> bool

Returns true if this transaction has transparent or shielded inputs.

Source

pub fn has_transparent_or_shielded_outputs(&self) -> bool

Returns true if this transaction has transparent or shielded outputs.

Source

pub fn has_enough_orchard_flags(&self) -> bool

Returns true if the Orchard flags are consistent.

Source

pub fn transparent_value_balance_from_outputs( &self, outputs: &HashMap<OutPoint, Output>, ) -> Result<ValueBalance<NegativeAllowed>, ValueBalanceError>

Return the transparent value balance, the change in the transaction value pool due to transparent inputs and outputs.

Source

pub fn sprout_value_balance( &self, ) -> Result<ValueBalance<NegativeAllowed>, ValueBalanceError>

Return the sprout value balance.

Errors when the aggregate JoinSplit value balance (or any prefix of it, matching the pre-refactor fold) leaves the valid monetary range. Aggregated here because zcash_primitives collapses that case to None, conflating it with “no Sprout bundle”. The net-sum bound matches zcashd from Canopy onward, where vpub_old is always zero; pre-Canopy heights are checkpointed.

Source

pub fn value_balance( &self, utxos: &HashMap<OutPoint, Utxo>, ) -> Result<ValueBalance<NegativeAllowed>, ValueBalanceError>

Get the overall value balance for this transaction.

Source

pub fn coinbase_spend_restriction( &self, network: &Network, spend_height: Height, ) -> CoinbaseSpendRestriction

Returns the transparent::CoinbaseSpendRestriction for this transaction, assuming it is mined at spend_height.

Source§

impl Transaction

Source

pub fn test_v1( inputs: Vec<Input>, outputs: Vec<Output>, lock_time: LockTime, ) -> Self

Build a V1 transaction from transparent components. Used in tests.

Source

pub fn test_v2( inputs: Vec<Input>, outputs: Vec<Output>, lock_time: LockTime, ) -> Self

Build a V2 transaction from transparent components. Used in tests.

Source

pub fn test_v3( inputs: Vec<Input>, outputs: Vec<Output>, lock_time: LockTime, expiry_height: Height, ) -> Self

Build a V3 (Overwinter) transaction from transparent components. Used in tests.

Source

pub fn test_v4( inputs: Vec<Input>, outputs: Vec<Output>, lock_time: LockTime, expiry_height: Height, ) -> Self

Build a V4 (Sapling) transaction from transparent components. Used in tests.

Source

pub fn test_v5( network_upgrade: NetworkUpgrade, inputs: Vec<Input>, outputs: Vec<Output>, lock_time: LockTime, expiry_height: Height, ) -> Self

Build a V5 (NU5) transaction from transparent components. Used in tests.

Source

pub fn test_v6( network_upgrade: NetworkUpgrade, inputs: Vec<Input>, outputs: Vec<Output>, lock_time: LockTime, expiry_height: Height, ) -> Self

Build a transparent-only V6 transaction, for tests.

Source

fn build_transparent( version: TxVersion, branch_id: BranchId, lock_time: u32, expiry_height: BlockHeight, inputs: Vec<Input>, outputs: Vec<Output>, ) -> Self

Source

pub fn test_v5_with_orchard( network_upgrade: NetworkUpgrade, inputs: Vec<Input>, outputs: Vec<Output>, lock_time: LockTime, expiry_height: Height, orchard_bundle: Option<Bundle<Authorized, ZatBalance>>, ) -> Self

Build a V5 transaction with an Orchard bundle, for tests.

The bundle must have been constructed for [orchard::bundle::BundleVersion::orchard_v2] or [orchard::bundle::BundleVersion::orchard_v3], matching network_upgrade.

Source

pub fn test_v6_with_bundles( network_upgrade: NetworkUpgrade, inputs: Vec<Input>, outputs: Vec<Output>, lock_time: LockTime, expiry_height: Height, orchard_bundle: Option<Bundle<Authorized, ZatBalance>>, ironwood_bundle: Option<Bundle<Authorized, ZatBalance>>, ) -> Self

Build a V6 transaction with Orchard and Ironwood bundles, for tests.

orchard_bundle must have been constructed for [orchard::bundle::BundleVersion::orchard_v3] and ironwood_bundle for [orchard::bundle::BundleVersion::ironwood_v3]; the two slots are not interchangeable.

Source

fn transparent_bundle_from( inputs: Vec<Input>, outputs: Vec<Output>, ) -> Option<Bundle<Authorized>>

Converts Zebra transparent inputs and outputs into a librustzcash bundle, returning None if both are empty.

Source

pub fn with_transparent_inputs(self, inputs: Vec<Input>) -> Self

Rebuild this transaction with new transparent inputs.

Source

pub fn with_transparent_outputs(self, outputs: Vec<Output>) -> Self

Rebuild this transaction with new transparent outputs.

Source

fn rebuild_with_transparent( self, transparent_bundle: Option<Bundle<Authorized>>, ) -> Self

Source

pub fn set_expiry_height(&mut self, height: Height)

Rebuild this transaction with a different expiry height (recomputes txid).

Source

pub fn set_network_upgrade(&mut self, nu: NetworkUpgrade)

Rebuild this transaction with a different network upgrade / branch ID (recomputes txid).

Source

pub fn set_outputs(&mut self, outputs: Vec<Output>)

Replace all transparent outputs (recomputes txid).

Source

pub fn with_orchard_bundle( self, bundle: Option<Bundle<Authorized, ZatBalance>>, ) -> Self

Rebuild this transaction with a replaced Orchard bundle (recomputes txid).

Test helper for synthesizing transactions with malformed orchard data (e.g. duplicated actions) that would otherwise be unreachable through normal construction paths.

Source

pub fn test_v4_with_joinsplit_data( joinsplit_data: Option<&JoinSplitData<Groth16Proof>>, ) -> Self

Build a V4 transaction with optional JoinSplit data via byte-level serialization.

Transparent inputs/outputs and sapling shielded data are empty. Used by tests that need V4 transactions with sprout data.

Methods from Deref<Target = TransactionData<Authorized>>§

pub fn version(&self) -> TxVersion

Returns the transaction version.

pub fn consensus_branch_id(&self) -> BranchId

Returns the Zcash epoch that this transaction can be mined in.

pub fn lock_time(&self) -> u32

pub fn expiry_height(&self) -> BlockHeight

pub fn transparent_bundle( &self, ) -> Option<&Bundle<<A as Authorization>::TransparentAuth>>

pub fn sprout_bundle(&self) -> Option<&Bundle>

pub fn sapling_bundle( &self, ) -> Option<&Bundle<<A as Authorization>::SaplingAuth, ZatBalance>>

pub fn orchard_bundle( &self, ) -> Option<&Bundle<<A as Authorization>::OrchardAuth, ZatBalance>>

pub fn ironwood_bundle( &self, ) -> Option<&Bundle<<A as Authorization>::OrchardAuth, ZatBalance>>

pub fn fee_paid<E, F>(&self, get_prevout: F) -> Result<Option<Zatoshis>, E>
where E: From<BalanceError>, F: FnMut(&OutPoint) -> Result<Option<Zatoshis>, E>,

Returns the total fees paid by the transaction, given a function that can be used to retrieve the value of previous transactions’ transparent outputs that are being spent in this transaction.

pub fn digest<D>(&self, digester: D) -> <D as TransactionDigest<A>>::Digest
where D: TransactionDigest<A>,

Computes this transaction’s digest using the provided digest strategy.

Version 6 transactions include the Ironwood bundle digest as a separate Orchard-shaped digest with Ironwood personalization. Earlier transaction versions do not include Ironwood in their digest.

pub fn sapling_value_balance(&self) -> ZatBalance

Trait Implementations§

Source§

impl Arbitrary for Transaction

Source§

type Parameters = LedgerState

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
Source§

type Strategy = BoxedStrategy<Transaction>

The type of Strategy used to generate values of type Self.
Source§

fn arbitrary_with(ledger_state: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
Source§

impl Clone for Transaction

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Transaction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Transaction

Source§

type Target = TransactionData<Authorized>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Display for Transaction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Transaction

Source§

impl From<&Transaction> for WtxId

Source§

fn from(transaction: &Transaction) -> Self

Computes the witnessed transaction ID for a transaction.

§Panics

If passed a pre-v5 transaction.

Source§

impl From<&Transaction> for Hash

Source§

fn from(transaction: &Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<&Transaction> for UnminedTxId

Source§

fn from(transaction: &Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<Transaction> for Hash

Source§

fn from(transaction: Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<Transaction> for UnminedTxId

Source§

fn from(transaction: Transaction) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Transaction

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Transaction

Available on crate features elasticsearch or proptest-impl only.
Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl TrustedPreallocate for Transaction

No valid Zcash message contains more transactions than can fit in a single block

tx messages contain a single transaction, and block messages are limited to the maximum block size.

Source§

fn max_allocation() -> u64

Provides a loose upper bound on the size of the Vec<T: TrustedPreallocate> which can possibly be received from an honest peer.
Source§

impl TryFrom<&Transaction> for AuthDigest

Source§

fn try_from(transaction: &Transaction) -> Result<Self, Self::Error>

Computes the authorizing data commitment for a transaction.

Returns an error if passed a pre-V5 transaction (which has no auth digest).

Source§

type Error = &'static str

The type returned in the event of a conversion error.
Source§

impl ZcashDeserialize for Transaction

Source§

fn zcash_deserialize<R: Read>(reader: R) -> Result<Self, SerializationError>

Deserialize a transaction without network context.

§Branch ID handling
  • V5+ transactions: the consensus branch ID is read from the wire. Correct.
  • V1-V4 transactions: the branch ID is NOT on the wire, so a default (BranchId::Canopy) is stored. This does not affect parsing or txid computation, but the stored consensus_branch_id field will be wrong for transactions mined before Canopy. Use ZcashDeserializeWithContext<BranchId> when the correct branch ID is known.
§Callers

Prefer ZcashDeserializeWithContext<BranchId> when the correct branch ID is known. This context-free impl exists for:

  • Block deserialization (branch ID is corrected afterward)
  • Network message parsing and RPC (transactions are re-validated with the correct branch ID before sighash computation)
Source§

impl ZcashDeserializeWithContext<BranchId> for Transaction

Source§

fn zcash_deserialize_with_context<R: Read>( reader: R, branch_id: &BranchId, ) -> Result<Self, SerializationError>

Deserialize a transaction with a known consensus branch ID.

Runs the same parse-time consensus checks as Transaction::zcash_deserialize.

Source§

impl ZcashSerialize for Transaction

Source§

fn zcash_serialize<W: Write>(&self, writer: W) -> Result<(), Error>

Write self to the given writer using the canonical format. Read more
Source§

fn zcash_serialize_to_vec(&self) -> Result<Vec<u8>, Error>

Helper function to construct a vec to serialize the current struct into
Source§

fn zcash_serialized_size(&self) -> usize

Get the size of self by using a fake writer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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> MaybeSendSync for T

§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either [OwoColorize::fg] or a color-specific method, such as [OwoColorize::green], Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either [OwoColorize::bg] or a color-specific method, such as [OwoColorize::on_yellow], Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows 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) -> R
where R: 'a,

Mutably borrows 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
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<Response, Error> ResponseResult<Response, Error> for Response

Source§

fn into_result(self) -> Result<Response, Error>

Converts the type into a Result that can be sent as a response.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SectionExt for T
where T: Display + Send + Sync + 'static,

Source§

fn header<C>(self, header: C) -> IndentedSection<C, T>
where C: Display + Send + Sync + 'static,

Add a header to a Section and indent the body Read more
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 2760 bytes