Skip to main content

sighash

Function sighash 

Source
pub(crate) fn sighash(
    precomputed_tx_data: &PrecomputedTxData,
    hash_type: HashType,
    input_index_script_code: Option<(usize, Vec<u8>)>,
) -> SigHash
Expand description

Compute a signature hash using librustzcash.

§Inputs

  • precomputed_tx_data: precomputed data for the transaction whose signature hash is being computed.
  • hash_type: the type of hash (SIGHASH) being used.
  • input_index_script_code: a tuple with the index of the transparent Input for which we are producing a sighash and the respective script code being validated, or None if it’s a shielded input.

§Panics

  • if input_index_script_code is Some((input_index, _)) and input_index is out of bounds for precomputed_tx_data.all_previous_outputs. The public callers in zebra-chain document this as a precondition.
  • if the previous output at input_index has a value that cannot be converted to Zatoshis. Output values are validated before sighash computation, so this branch is unreachable in practice.