pub fn validate<R: RngCore + CryptoRng>(
    tx: &Tx,
    current_block_index: u64,
    root_proofs: &[TxOutMembershipProof],
    csprng: &mut R,
) -> TransactionValidationResult<()> {
    validate_number_of_inputs(&tx.prefix, MAX_INPUTS)?;

    validate_number_of_outputs(&tx.prefix, MAX_OUTPUTS)?;

    validate_ring_sizes(&tx.prefix, RING_SIZE)?;

    validate_ring_elements_are_unique(&tx.prefix)?;

    validate_membership_proofs(&tx.prefix, &root_proofs)?;

    validate_transaction_signature(&tx, csprng)?;

    validate_transaction_fee(&tx)?;

    validate_key_images_are_unique(&tx)?;

    validate_tombstone(current_block_index, tx.prefix.tombstone_block)?;

    // Note: The transaction must not contain a Key Image that has previously been spent.
    // This must be checked outside the enclave.

    Ok(())
}
/// Determines if the transaction is valid, with respect to the provided context.
///
/// # Arguments
/// * `tx` - A pending transaction.
/// * `current_block_index` - The index of the current block that is being built.
/// * `root_proofs` - Membership proofs for each input ring element contained in `tx`.
/// * `csprng` - Cryptographically secure random number generator.
Determines if the transaction is valid, with respect to the provided context.
Determines if the transaction is valid with respect to the provided context .
pub fn validate<R: RngCore + CryptoRng>(
    tx: &Tx,
    current_block_index: u64,
    root_proofs: &[TxOutMembershipProof],
    csprng: &mut R,
) -> TransactionValidationResult<()> {
    validate_number_of_inputs(&tx.prefix, MAX_INPUTS)?;
    validate_number_of_outputs(&tx.prefix, MAX_OUTPUTS)?;
    validate_ring_sizes(&tx.prefix, RING_SIZE)?;
    validate_ring_elements_are_unique(&tx.prefix)?;
    validate_membership_proofs(&tx.prefix, &root_proofs)?;
    validate_transaction_signature(&tx, csprng)?;
    validate_transaction_fee(&tx)?;
    validate_key_images_are_unique(&tx)?;
    validate_tombstone(current_block_index, tx.prefix.tombstone_block)?;
    // Note: The transaction must not contain a Key Image that has previously been spent.
    // This must be checked outside the enclave.
    Ok(())
}
pub fn validate < R : RngCore + CryptoRng > ( tx : & Tx , current_block_index : u64 , root_proofs : & [ TxOutMembershipProof ] , csprng : & mut R , ) -> TransactionValidationResult < ( ) > { validate_number_of_inputs ( & tx . prefix , MAX_INPUTS ) ? ; validate_number_of_outputs ( & tx . prefix , MAX_OUTPUTS ) ? ; validate_ring_sizes ( & tx . prefix , RING_SIZE ) ? ; validate_ring_elements_are_unique ( & tx . prefix ) ? ; validate_membership_proofs ( & tx . prefix , & root_proofs ) ? ; validate_transaction_signature ( & tx , csprng ) ? ; validate_transaction_fee ( & tx ) ? ; validate_key_images_are_unique ( & tx ) ? ; validate_tombstone ( current_block_index , tx . prefix . tombstone_block ) ? ; // Note: The transaction must not contain a Key Image that has previously been spent. // This must be checked outside the enclave. Ok ( ( ) ) }
Determines if the transaction is valid, with respect to the provided context.
Determines if the transaction is valid with respect to the provided context .
tx
&Tx
current_block_index
u64
root_proofs
&[TxOutMembershipProof]
csprng
&mut R
tx
&Tx
current_block_index
u64
root_proofs
&[TxOutMembershipProof]
csprng
&mut R