Skip to main content

check_transaction

Function check_transaction 

Source
pub fn check_transaction(
    tx: &Transaction,
) -> Result<ValidationResult, ConsensusError>
Expand description

CheckTransaction: 𝒯𝒳 → {valid, invalid}

A transaction tx = (v, ins, outs, lt) is valid if and only if:

  1. |ins| > 0 ∧ |outs| > 0
  2. ∀o ∈ outs: 0 ≤ o.value ≤ M_max
  3. ∑_{o ∈ outs} o.value ≤ M_max (total output sum)
  4. |ins| ≤ M_max_inputs
  5. |outs| ≤ M_max_outputs
  6. |tx| ≤ M_max_tx_size
  7. ∀i,j ∈ ins: i ≠ j ⟹ i.prevout ≠ j.prevout (no duplicate inputs)
  8. If tx is coinbase: 2 ≤ |ins[0].scriptSig| ≤ 100

Uses fast-path checks before full validation.