diff --git a/zebra-chain/src/parameters/network_upgrade.rs b/zebra-chain/src/parameters/network_upgrade.rs index f766c7bf9..bf3452f07 100644 --- a/zebra-chain/src/parameters/network_upgrade.rs +++ b/zebra-chain/src/parameters/network_upgrade.rs @@ -187,20 +187,23 @@ impl NetworkUpgrade { /// and it's a test build, this returns a list of fake activation heights /// used by some tests. pub(crate) fn activation_list(network: Network) -> BTreeMap { - println!( - "activation_list called {:?}", - std::env::var_os("TEST_FAKE_ACTIVATION_HEIGHTS") - ); let (mainnet_heights, testnet_heights) = { #[cfg(not(feature = "zebra-test"))] { (MAINNET_ACTIVATION_HEIGHTS, TESTNET_ACTIVATION_HEIGHTS) } + // To prevent accidentally setting this somehow, only check the env var // when being compiled for tests. We can't use cfg(test) since the // test that uses this is in zebra-state, and cfg(test) is not // set for dependencies. However, zebra-state does set the // zebra-test feature of zebra-chain if it's a dev dependency. + // + // Cargo features are additive, so all test binaries built along with + // zebra-state will have this feature enabled. But we are using + // Rust Edition 2021 and Cargo resolver version 2, so the "zebra-test" + // feature should only be enabled for tests: + // https://doc.rust-lang.org/cargo/reference/features.html#resolver-version-2-command-line-flags #[cfg(feature = "zebra-test")] if std::env::var_os("TEST_FAKE_ACTIVATION_HEIGHTS").is_some() { (