Checks that default Mainnet/Testnet/Regtest Sapling HRPs pass validation in `with_sapling_hrps()`

This commit is contained in:
Arya 2024-04-18 16:34:11 -04:00
parent d8715909e2
commit 4671efe98c
1 changed files with 23 additions and 1 deletions

View File

@ -1,6 +1,9 @@
//! Fixed test vectors for the network consensus parameters.
use zcash_primitives::consensus::{self as zp_consensus, Parameters};
use zcash_primitives::{
consensus::{self as zp_consensus, Parameters},
constants as zp_constants,
};
use crate::{
block::Height,
@ -266,4 +269,23 @@ fn check_configured_sapling_hrps() {
expected_hrp_sapling_payment_address,
"should return expected Sapling payment address HRP"
);
// Check that default Mainnet, Testnet, and Regtest HRPs are valid, these calls will panic
// if any of the values fail validation.
testnet::Parameters::build()
.with_sapling_hrps(
zp_constants::mainnet::HRP_SAPLING_EXTENDED_SPENDING_KEY,
zp_constants::mainnet::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY,
zp_constants::mainnet::HRP_SAPLING_PAYMENT_ADDRESS,
)
.with_sapling_hrps(
zp_constants::testnet::HRP_SAPLING_EXTENDED_SPENDING_KEY,
zp_constants::testnet::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY,
zp_constants::testnet::HRP_SAPLING_PAYMENT_ADDRESS,
)
.with_sapling_hrps(
zp_constants::regtest::HRP_SAPLING_EXTENDED_SPENDING_KEY,
zp_constants::regtest::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY,
zp_constants::regtest::HRP_SAPLING_PAYMENT_ADDRESS,
);
}