diff --git a/zebra-consensus/src/block.rs b/zebra-consensus/src/block.rs index f7813b16e..277a1dd38 100644 --- a/zebra-consensus/src/block.rs +++ b/zebra-consensus/src/block.rs @@ -53,8 +53,15 @@ pub(crate) fn node_time_check( } } +/// Check that there is exactly one coinbase transaction in `Block`, and that +/// the coinbase transaction is the first transaction in the block. +/// +/// "The first (and only the first) transaction in a block is a coinbase +/// transaction, which collects and spends any miner subsidy and transaction +/// fees paid by transactions included in this block."[S 3.10][3.10] +/// /// [3.10]: https://zips.z.cash/protocol/protocol.pdf#coinbasetransactions -pub(crate) fn coinbase_check(block: &Block) -> Result<(), Error> { +pub(crate) fn coinbase_is_first_check(block: Arc) -> Result<(), Error> { if block.coinbase_height().is_some() { // No coinbase inputs in additional transactions allowed if block @@ -116,7 +123,7 @@ where let now = Utc::now(); node_time_check(block.header.time, now)?; block.header.is_equihash_solution_valid()?; - coinbase_check(block.as_ref())?; + coinbase_is_first_check(block.clone())?; // `Tower::Buffer` requires a 1:1 relationship between `poll()`s // and `call()`s, because it reserves a buffer slot in each