Apply suggestions from code review

Co-authored-by: Marek <mail@marek.onl>
This commit is contained in:
Arya 2024-04-11 12:36:30 -04:00 committed by GitHub
parent 05e41a2803
commit fd3d50572c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -65,11 +65,11 @@ impl NetworkParameters {
}
}
#[derive(Copy, Clone, Default, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
/// An enum describing the kind of network, whether it's the production mainnet or a testnet.
// Note: The order of these variants is important for correct bincode (de)serialization
// of history trees in the db format.
// TODO: Replace bincode (de)serialization of `HistoryTreeParts` in a db format upgrade?
#[derive(Copy, Clone, Default, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum NetworkKind {
/// The production mainnet.
#[default]

View File

@ -231,7 +231,6 @@ impl ParameterSubsidy for Network {
Network::Mainnet => NetworkUpgrade::Canopy
.activation_height(self)
.expect("canopy activation height should be available"),
// TODO: Check what zcashd does here, consider adding a field to `NetworkParamters` to make this configurable.
Network::Testnet(_params) => FIRST_HALVING_TESTNET,
}

View File

@ -506,7 +506,8 @@ fn address_variant(address: &transparent::Address) -> u8 {
(Mainnet, PayToPublicKeyHash { .. }) => 0,
(Mainnet, PayToScriptHash { .. }) => 1,
// There's no way to distinguish between Regtest and Testnet for encoded transparent addresses,
// so the network kind should always be `Mainnet` or `Testnet`.
// we can consider `Regtest` to use `Testnet` transparent addresses, so it's okay to use the `Testnet`
// address variant for `Regtest` transparent addresses in the db format
(Testnet | Regtest, PayToPublicKeyHash { .. }) => 2,
(Testnet | Regtest, PayToScriptHash { .. }) => 3,
}