Always activate Canopy at Height(1) on Regtest
This commit is contained in:
parent
301900435b
commit
663ad1e629
|
@ -11,8 +11,6 @@ use crate::{
|
||||||
parameters::NetworkUpgrade,
|
parameters::NetworkUpgrade,
|
||||||
};
|
};
|
||||||
|
|
||||||
use self::testnet::ConfiguredActivationHeights;
|
|
||||||
|
|
||||||
pub mod testnet;
|
pub mod testnet;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -167,8 +165,9 @@ impl Network {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new [`Network::Testnet`] with `Regtest` parameters and the provided network upgrade activation heights.
|
/// Creates a new [`Network::Testnet`] with `Regtest` parameters and the provided network upgrade activation heights.
|
||||||
pub fn new_regtest(activation_heights: ConfiguredActivationHeights) -> Self {
|
// TODO: Support constructing pre-Canopy block templates and accept more activation heights (#8434)
|
||||||
Self::new_configured_testnet(testnet::Parameters::new_regtest(activation_heights))
|
pub fn new_regtest(nu5_activation_height: Option<u32>) -> Self {
|
||||||
|
Self::new_configured_testnet(testnet::Parameters::new_regtest(nu5_activation_height))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the network is Mainnet or the default Testnet, or false otherwise.
|
/// Returns true if the network is Mainnet or the default Testnet, or false otherwise.
|
||||||
|
|
|
@ -328,7 +328,7 @@ impl Parameters {
|
||||||
/// Accepts a [`ConfiguredActivationHeights`].
|
/// Accepts a [`ConfiguredActivationHeights`].
|
||||||
///
|
///
|
||||||
/// Creates an instance of [`Parameters`] with `Regtest` values.
|
/// Creates an instance of [`Parameters`] with `Regtest` values.
|
||||||
pub fn new_regtest(activation_heights: ConfiguredActivationHeights) -> Self {
|
pub fn new_regtest(nu5_activation_height: Option<u32>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
network_name: "Regtest".to_string(),
|
network_name: "Regtest".to_string(),
|
||||||
..Self::build()
|
..Self::build()
|
||||||
|
@ -342,7 +342,11 @@ impl Parameters {
|
||||||
)
|
)
|
||||||
// Removes default Testnet activation heights if not configured,
|
// Removes default Testnet activation heights if not configured,
|
||||||
// most network upgrades are disabled by default for Regtest in zcashd
|
// most network upgrades are disabled by default for Regtest in zcashd
|
||||||
.with_activation_heights(activation_heights)
|
.with_activation_heights(ConfiguredActivationHeights {
|
||||||
|
canopy: Some(1),
|
||||||
|
nu5: nu5_activation_height,
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +368,7 @@ impl Parameters {
|
||||||
hrp_sapling_payment_address,
|
hrp_sapling_payment_address,
|
||||||
disable_pow,
|
disable_pow,
|
||||||
debug_validate_without_checkpoints,
|
debug_validate_without_checkpoints,
|
||||||
} = Self::new_regtest(ConfiguredActivationHeights::default());
|
} = Self::new_regtest(None);
|
||||||
|
|
||||||
self.network_name == network_name
|
self.network_name == network_name
|
||||||
&& self.genesis_hash == genesis_hash
|
&& self.genesis_hash == genesis_hash
|
||||||
|
|
|
@ -134,7 +134,7 @@ fn activates_network_upgrades_correctly() {
|
||||||
|
|
||||||
let expected_default_regtest_activation_heights = &[
|
let expected_default_regtest_activation_heights = &[
|
||||||
(Height(0), NetworkUpgrade::Genesis),
|
(Height(0), NetworkUpgrade::Genesis),
|
||||||
(Height(1), NetworkUpgrade::BeforeOverwinter),
|
(Height(1), NetworkUpgrade::Canopy),
|
||||||
];
|
];
|
||||||
|
|
||||||
for (network, expected_activation_heights) in [
|
for (network, expected_activation_heights) in [
|
||||||
|
|
|
@ -639,7 +639,7 @@ impl<'de> Deserialize<'de> for Config {
|
||||||
listen_addr: String,
|
listen_addr: String,
|
||||||
network: NetworkKind,
|
network: NetworkKind,
|
||||||
testnet_parameters: Option<DTestnetParameters>,
|
testnet_parameters: Option<DTestnetParameters>,
|
||||||
regtest_activation_heights: ConfiguredActivationHeights,
|
regtest_nu5_activation_height: Option<u32>,
|
||||||
initial_mainnet_peers: IndexSet<String>,
|
initial_mainnet_peers: IndexSet<String>,
|
||||||
initial_testnet_peers: IndexSet<String>,
|
initial_testnet_peers: IndexSet<String>,
|
||||||
cache_dir: CacheDir,
|
cache_dir: CacheDir,
|
||||||
|
@ -656,7 +656,7 @@ impl<'de> Deserialize<'de> for Config {
|
||||||
listen_addr: "0.0.0.0".to_string(),
|
listen_addr: "0.0.0.0".to_string(),
|
||||||
network: Default::default(),
|
network: Default::default(),
|
||||||
testnet_parameters: None,
|
testnet_parameters: None,
|
||||||
regtest_activation_heights: ConfiguredActivationHeights::default(),
|
regtest_nu5_activation_height: None,
|
||||||
initial_mainnet_peers: config.initial_mainnet_peers,
|
initial_mainnet_peers: config.initial_mainnet_peers,
|
||||||
initial_testnet_peers: config.initial_testnet_peers,
|
initial_testnet_peers: config.initial_testnet_peers,
|
||||||
cache_dir: config.cache_dir,
|
cache_dir: config.cache_dir,
|
||||||
|
@ -671,7 +671,7 @@ impl<'de> Deserialize<'de> for Config {
|
||||||
listen_addr,
|
listen_addr,
|
||||||
network: network_kind,
|
network: network_kind,
|
||||||
testnet_parameters,
|
testnet_parameters,
|
||||||
regtest_activation_heights,
|
regtest_nu5_activation_height,
|
||||||
mut initial_mainnet_peers,
|
mut initial_mainnet_peers,
|
||||||
mut initial_testnet_peers,
|
mut initial_testnet_peers,
|
||||||
cache_dir,
|
cache_dir,
|
||||||
|
@ -703,7 +703,7 @@ impl<'de> Deserialize<'de> for Config {
|
||||||
(NetworkKind::Regtest, _) => {
|
(NetworkKind::Regtest, _) => {
|
||||||
initial_mainnet_peers = Default::default();
|
initial_mainnet_peers = Default::default();
|
||||||
initial_testnet_peers = Default::default();
|
initial_testnet_peers = Default::default();
|
||||||
Network::new_regtest(regtest_activation_heights)
|
Network::new_regtest(regtest_nu5_activation_height)
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
NetworkKind::Testnet,
|
NetworkKind::Testnet,
|
||||||
|
|
|
@ -59,6 +59,7 @@ listen_addr = "0.0.0.0:8233"
|
||||||
max_connections_per_ip = 1
|
max_connections_per_ip = 1
|
||||||
network = "Regtest"
|
network = "Regtest"
|
||||||
peerset_initial_target_size = 25
|
peerset_initial_target_size = 25
|
||||||
|
regtest_nu5_activation_height = 1
|
||||||
|
|
||||||
[network.testnet_parameters]
|
[network.testnet_parameters]
|
||||||
network_name = "ConfiguredTestnet_1"
|
network_name = "ConfiguredTestnet_1"
|
||||||
|
@ -72,15 +73,6 @@ Heartwood = 903_800
|
||||||
Canopy = 1_028_500
|
Canopy = 1_028_500
|
||||||
NU5 = 1_842_420
|
NU5 = 1_842_420
|
||||||
|
|
||||||
[network.regtest_activation_heights]
|
|
||||||
BeforeOverwinter = 1
|
|
||||||
Overwinter = 207_500
|
|
||||||
Sapling = 280_000
|
|
||||||
Blossom = 584_000
|
|
||||||
Heartwood = 903_800
|
|
||||||
Canopy = 1_028_500
|
|
||||||
NU5 = 1_842_420
|
|
||||||
|
|
||||||
[rpc]
|
[rpc]
|
||||||
debug_force_finished_sync = false
|
debug_force_finished_sync = false
|
||||||
parallel_cpu_threads = 0
|
parallel_cpu_threads = 0
|
||||||
|
|
Loading…
Reference in New Issue