From 2eceff421f4730110e005b9238eadbbac7a1098d Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Thu, 19 Nov 2020 19:17:27 -0800 Subject: [PATCH] consensus: remove incorrect check This consensus rule is supposed to apply to transactions whose transparent inputs are the *outputs* of previous coinbase transactions, not to transactions with coinbase inputs. Because that logic is different enough from this logic, and requires different data flow, it's cleaner to just remove this check for now. --- zebra-consensus/src/transaction.rs | 1 - zebra-consensus/src/transaction/check.rs | 22 ---------------------- 2 files changed, 23 deletions(-) diff --git a/zebra-consensus/src/transaction.rs b/zebra-consensus/src/transaction.rs index ef2f5377..75ff014d 100644 --- a/zebra-consensus/src/transaction.rs +++ b/zebra-consensus/src/transaction.rs @@ -131,7 +131,6 @@ where } check::has_inputs_and_outputs(&tx)?; - check::any_coinbase_inputs_no_transparent_outputs(&tx)?; let sighash = tx.sighash( NetworkUpgrade::Sapling, // TODO: pass this in diff --git a/zebra-consensus/src/transaction/check.rs b/zebra-consensus/src/transaction/check.rs index 3060220f..40e199ed 100644 --- a/zebra-consensus/src/transaction/check.rs +++ b/zebra-consensus/src/transaction/check.rs @@ -74,28 +74,6 @@ pub fn has_inputs_and_outputs(tx: &Transaction) -> Result<(), TransactionError> } } -/// Check that a transaction with one or more transparent inputs from coinbase -/// transactions has no transparent outputs. -/// -/// Note that inputs from coinbase transactions include Founders’ Reward -/// outputs. -/// -/// https://zips.z.cash/protocol/canopy.pdf#consensusfrombitcoin -pub fn any_coinbase_inputs_no_transparent_outputs( - tx: &Transaction, -) -> Result<(), TransactionError> { - match tx { - Transaction::V4 { outputs, .. } => { - if !tx.contains_coinbase_input() || !outputs.is_empty() { - Ok(()) - } else { - Err(TransactionError::NoTransfer) - } - } - _ => Err(TransactionError::WrongVersion), - } -} - /// Check that if there are no Spends or Outputs, that valueBalance is also 0. /// /// https://zips.z.cash/protocol/canopy.pdf#consensusfrombitcoin