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:
- |ins| > 0 ∧ |outs| > 0
- ∀o ∈ outs: 0 ≤ o.value ≤ M_max
- ∑_{o ∈ outs} o.value ≤ M_max (total output sum)
- |ins| ≤ M_max_inputs
- |outs| ≤ M_max_outputs
- |tx| ≤ M_max_tx_size
- ∀i,j ∈ ins: i ≠ j ⟹ i.prevout ≠ j.prevout (no duplicate inputs)
- If tx is coinbase: 2 ≤ |ins[0].scriptSig| ≤ 100
Uses fast-path checks before full validation.