Rename functions to subsidy_is_valid*
To match the other check::* functions. Automated commit, created using the script: sed -i 's/subsidy_is_correct/subsidy_is_valid/' \ $(grep -r subsidy_is_correct zebra* | cut -d: -f1 | sort -u)
This commit is contained in:
parent
407962b864
commit
3fad3cf3af
|
@ -151,7 +151,7 @@ where
|
|||
check::time_is_valid_at(&block.header, now, &height, &hash)
|
||||
.map_err(VerifyBlockError::Time)?;
|
||||
check::coinbase_is_first(&block)?;
|
||||
check::subsidy_is_correct(network, &block)?;
|
||||
check::subsidy_is_valid(network, &block)?;
|
||||
|
||||
// TODO: context-free header verification: merkle root
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ pub fn time_is_valid_at(
|
|||
/// Returns `Ok(())` if the block subsidy and miner fees in `block` are valid for `network`
|
||||
///
|
||||
/// [3.9]: https://zips.z.cash/protocol/protocol.pdf#subsidyconcepts
|
||||
pub fn subsidy_is_correct(network: Network, block: &Block) -> Result<(), BlockError> {
|
||||
pub fn subsidy_is_valid(network: Network, block: &Block) -> Result<(), BlockError> {
|
||||
let height = block.coinbase_height().ok_or(SubsidyError::NoCoinbase)?;
|
||||
let coinbase = block.transactions.get(0).ok_or(SubsidyError::NoCoinbase)?;
|
||||
|
||||
|
|
|
@ -154,14 +154,14 @@ fn time_check_past_block() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn subsidy_is_correct_test() -> Result<(), Report> {
|
||||
subsidy_is_correct_for_network(Network::Mainnet)?;
|
||||
subsidy_is_correct_for_network(Network::Testnet)?;
|
||||
fn subsidy_is_valid_test() -> Result<(), Report> {
|
||||
subsidy_is_valid_for_network(Network::Mainnet)?;
|
||||
subsidy_is_valid_for_network(Network::Testnet)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn subsidy_is_correct_for_network(network: Network) -> Result<(), Report> {
|
||||
fn subsidy_is_valid_for_network(network: Network) -> Result<(), Report> {
|
||||
let block_iter = match network {
|
||||
Network::Mainnet => zebra_test::vectors::MAINNET_BLOCKS.iter(),
|
||||
Network::Testnet => zebra_test::vectors::TESTNET_BLOCKS.iter(),
|
||||
|
@ -175,7 +175,7 @@ fn subsidy_is_correct_for_network(network: Network) -> Result<(), Report> {
|
|||
if block::Height(height) > SLOW_START_INTERVAL
|
||||
&& block::Height(height) < NetworkUpgrade::Canopy.activation_height(network).unwrap()
|
||||
{
|
||||
check::subsidy_is_correct(network, &block)
|
||||
check::subsidy_is_valid(network, &block)
|
||||
.expect("subsidies should pass for this block");
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ fn nocoinbase_validation_failure() -> Result<(), Report> {
|
|||
block.transactions.remove(0);
|
||||
|
||||
// Validate the block
|
||||
let result = check::subsidy_is_correct(network, &block).unwrap_err();
|
||||
let result = check::subsidy_is_valid(network, &block).unwrap_err();
|
||||
let expected = BlockError::Transaction(TransactionError::Subsidy(SubsidyError::NoCoinbase));
|
||||
assert_eq!(expected, result);
|
||||
|
||||
|
@ -244,7 +244,7 @@ fn founders_reward_validation_failure() -> Result<(), Report> {
|
|||
};
|
||||
|
||||
// Validate it
|
||||
let result = check::subsidy_is_correct(network, &block).unwrap_err();
|
||||
let result = check::subsidy_is_valid(network, &block).unwrap_err();
|
||||
let expected = BlockError::Transaction(TransactionError::Subsidy(
|
||||
SubsidyError::FoundersRewardNotFound,
|
||||
));
|
||||
|
|
Loading…
Reference in New Issue