prepare_transaction_witness

Function prepare_transaction_witness 

Source
pub fn prepare_transaction_witness(
    case: &TxCase,
    leaves: Vec<FpBN256>,
    expected_levels: usize,
) -> Result<TransactionWitness>
Expand description

Builds the witnesses needed to exercise a TxCase

Populates commitment leaves in the Merkle tree, derives Merkle proofs for each input note, and computes nullifiers. This prepares all the witness data required for proving a transaction.

§Arguments

  • case - Transaction case containing input and output notes
  • leaves - Initial leaves vector (will be modified with commitments)
  • expected_levels - Expected number of levels in the Merkle tree

§Returns

Returns Ok(TransactionWitness) containing the root, public keys, nullifiers, path indices, and flattened path elements, or an error if the tree depth doesn’t match expectations.