Skip to main content

are_inputs_standard

Function are_inputs_standard 

Source
pub(super) fn are_inputs_standard(
    tx: &Transaction,
    spent_outputs: &[Output],
) -> bool
Expand description

Returns true if all transparent inputs are standard.

Mirrors zcashd’s AreInputsStandard(): https://github.com/zcash/zcash/blob/v6.11.0/src/policy/policy.cpp#L136

For each input:

  1. The spent output’s scriptPubKey must be a known standard type (via the zcash_script solver). Non-standard scripts and OP_RETURN outputs are rejected.
  2. The scriptSig stack depth must match ScriptSigArgsExpected().
  3. For P2SH inputs:
    • If the redeemed script is standard, its expected args are added to the total.
    • If the redeemed script is non-standard, it must have <= MAX_P2SH_SIGOPS sigops.

§Panics

Callers must ensure spent_outputs.len() matches the number of transparent inputs.