pub fn coinbase_tx_no_joinsplit_or_spend(tx: &Transaction) -> Result<(), TransactionError> {
    if tx.is_coinbase() {
        match tx {
            // Check if there is any JoinSplitData.
            Transaction::V4 {
                joinsplit_data: Some(_),
                ..
            } => Err(TransactionError::CoinbaseHasJoinSplit),

            // The ShieldedData contains both Spends and Outputs, and Outputs
            // are allowed post-Heartwood, so we have to count Spends.
            Transaction::V4 {
                sapling_shielded_data: Some(sapling_shielded_data),
                ..
            } if sapling_shielded_data.spends().count() > 0 => {
                Err(TransactionError::CoinbaseHasSpend)
            }

            Transaction::V4 { .. } => Ok(()),

            Transaction::V1 { .. } | Transaction::V2 { .. } | Transaction::V3 { .. } => {
                unreachable!("tx version is checked first")
            }

            Transaction::V5 { .. } => {
                unimplemented!("v5 coinbase validation as specified in ZIP-225 and the draft spec")
            }
        }
    } else {
        Ok(())
    }
}
/// Check that a coinbase tx does not have any JoinSplit or Spend descriptions.
///
/// https://zips.z.cash/protocol/protocol.pdf#txnencodingandconsensus
Check that a coinbase tx does not have any JoinSplit or Spend descriptions.
Check that a coinbase tx does not have any JoinSplit or Spend descriptions .
pub fn coinbase_tx_no_joinsplit_or_spend(tx: &Transaction) -> Result<(), TransactionError> {
    if tx.is_coinbase() {
        match tx {
            // Check if there is any JoinSplitData.
            Transaction::V4 {
                joinsplit_data: Some(_),
                ..
            } => Err(TransactionError::CoinbaseHasJoinSplit),
            // The ShieldedData contains both Spends and Outputs, and Outputs
            // are allowed post-Heartwood, so we have to count Spends.
            Transaction::V4 {
                sapling_shielded_data: Some(sapling_shielded_data),
                ..
            } if sapling_shielded_data.spends().count() > 0 => {
                Err(TransactionError::CoinbaseHasSpend)
            }
            Transaction::V4 { .. } => Ok(()),
            Transaction::V1 { .. } | Transaction::V2 { .. } | Transaction::V3 { .. } => {
                unreachable!("tx version is checked first")
            }
            Transaction::V5 { .. } => {
                unimplemented!("v5 coinbase validation as specified in ZIP-225 and the draft spec")
            }
        }
    } else {
        Ok(())
    }
}
pub fn coinbase_tx_no_joinsplit_or_spend ( tx : & Transaction ) -> Result < ( ) , TransactionError > { if tx . is_coinbase ( ) { match tx { // Check if there is any JoinSplitData. Transaction :: V4 { joinsplit_data : Some ( _ ) , .. } => Err ( TransactionError :: CoinbaseHasJoinSplit ) , // The ShieldedData contains both Spends and Outputs, and Outputs // are allowed post-Heartwood, so we have to count Spends. Transaction :: V4 { sapling_shielded_data : Some ( sapling_shielded_data ) , .. } if sapling_shielded_data . spends ( ) . count ( ) > 0 => { Err ( TransactionError :: CoinbaseHasSpend ) } Transaction :: V4 { .. } => Ok ( ( ) ) , Transaction :: V1 { .. } | Transaction :: V2 { .. } | Transaction :: V3 { .. } => { unreachable ! ( " " ) } Transaction :: V5 { .. } => { unimplemented ! ( " " ) } } } else { Ok ( ( ) ) } }
Check that a coinbase tx does not have any JoinSplit or Spend descriptions.
Check that a coinbase tx does not have any JoinSplit or Spend descriptions .
tx
&Transaction