zebra_consensus/block/subsidy.rs
1//! Validate coinbase transaction rewards as described in [§7.8][7.8]
2//!
3//! [7.8]: https://zips.z.cash/protocol/protocol.pdf#subsidies
4
5use zebra_chain::transparent::{self, Script};
6
7/// Funding Streams functions apply for blocks at and after Canopy.
8pub mod funding_streams;
9
10/// Returns a new funding stream or lockbox disbursement coinbase output lock script, which pays to the P2SH `address`.
11pub fn new_coinbase_script(address: &transparent::Address) -> Script {
12 assert!(
13 address.is_script_hash(),
14 "incorrect coinbase script address: {address} \
15 Funding streams and lockbox disbursements only \
16 support transparent 'pay to script hash' (P2SH) addresses",
17 );
18
19 // > The “prescribed way” to pay a transparent P2SH address is to use a standard P2SH script
20 // > of the form OP_HASH160 fs.RedeemScriptHash(height) OP_EQUAL as the scriptPubKey.
21 //
22 // [7.10]: https://zips.z.cash/protocol/protocol.pdf#fundingstreams
23 address.script()
24}