adds todos

This commit is contained in:
Arya 2024-03-19 10:56:54 -04:00
parent d040c078b3
commit 50c00072dd
3 changed files with 8 additions and 11 deletions

View File

@ -271,8 +271,8 @@ impl Network {
};
match self {
Mainnet => mainnet_heights,
Testnet(_params) if self.is_default_testnet() => testnet_heights,
Testnet(_) => unimplemented!("custom testnet activation heights"),
// TODO: Add `activation_heights` field and use the above Testnet constants as the default value
Testnet(_params) => testnet_heights,
}
.iter()
.cloned()
@ -393,18 +393,17 @@ impl NetworkUpgrade {
height: block::Height,
) -> Option<Duration> {
match (network, height) {
// TODO: Add a field on `NetworkParameters` for minimum difficulty spacing and min difficulty start height
(Network::Testnet(_params), height)
if network.is_default_testnet()
&& height < TESTNET_MINIMUM_DIFFICULTY_START_HEIGHT =>
if height < TESTNET_MINIMUM_DIFFICULTY_START_HEIGHT =>
{
None
}
(Network::Mainnet, _) => None,
(Network::Testnet(_params), _) if network.is_default_testnet() => {
(Network::Testnet(_params), _) => {
let network_upgrade = NetworkUpgrade::current(network, height);
Some(network_upgrade.target_spacing() * TESTNET_MINIMUM_DIFFICULTY_GAP_MULTIPLIER)
}
_ => unimplemented!("custom testnet minimum difficulty spacing"),
}
}

View File

@ -65,6 +65,7 @@ impl TryFrom<Network> for zcash_address::Network {
Network::Testnet(_params) if network.is_default_testnet() => {
Ok(zcash_address::Network::Test)
}
// TODO: Check for Regtest parameters and return [`zcash_address::Network::Regtest`]
Network::Testnet(_params) => Err(UnsupportedNetwork),
}
}

View File

@ -699,11 +699,8 @@ impl ParameterDifficulty for Network {
/* 2^243 - 1 */
Network::Mainnet => (U256::one() << 243) - 1,
/* 2^251 - 1 */
Network::Testnet(_) if self.is_default_testnet() => (U256::one() << 251) - 1,
// Custom value
Network::Testnet(_params) => {
unimplemented!("custom testnet target difficulty limit")
}
// TODO: Add a `target_difficulty_limit` field to `NetworkParameters` and return the field
Network::Testnet(_) => (U256::one() << 251) - 1,
};
// `zcashd` converts the PoWLimit into a compact representation before