Function zebra_consensus::transaction::check::has_inputs_and_outputs
source · pub fn has_inputs_and_outputs(tx: &Transaction) -> Result<(), TransactionError>
Expand description
Checks that the transaction has inputs and outputs.
§Consensus
For Transaction::V4
:
[Sapling onward] If effectiveVersion < 5, then at least one of tx_in_count, nSpendsSapling, and nJoinSplit MUST be nonzero.
[Sapling onward] If effectiveVersion < 5, then at least one of tx_out_count, nOutputsSapling, and nJoinSplit MUST be nonzero.
For Transaction::V5
:
[NU5 onward] If effectiveVersion >= 5 then this condition MUST hold: tx_in_count > 0 or nSpendsSapling > 0 or (nActionsOrchard > 0 and enableSpendsOrchard = 1).
[NU5 onward] If effectiveVersion >= 5 then this condition MUST hold: tx_out_count > 0 or nOutputsSapling > 0 or (nActionsOrchard > 0 and enableOutputsOrchard = 1).
https://zips.z.cash/protocol/protocol.pdf#txnconsensus
This check counts both Coinbase
and PrevOut
transparent inputs.