Port fix_recent_blockhashes_sysvar_delay to FeatureSet

This commit is contained in:
Michael Vines 2020-09-23 22:34:00 -07:00
parent 5dcf348098
commit 5d6410c1cb
2 changed files with 12 additions and 9 deletions

View File

@ -3651,14 +3651,12 @@ impl Bank {
} }
fn fix_recent_blockhashes_sysvar_delay(&self) -> bool { fn fix_recent_blockhashes_sysvar_delay(&self) -> bool {
let activation_slot = match self.cluster_type() { match self.cluster_type() {
ClusterType::Development => 0, ClusterType::Development | ClusterType::Devnet | ClusterType::Testnet => true,
ClusterType::Devnet => 0, ClusterType::MainnetBeta => self
ClusterType::Testnet => 27_740_256, // Epoch 76 .feature_set
ClusterType::MainnetBeta => Slot::MAX / 2, .is_active(&feature_set::consistent_recent_blockhashes_sysvar::id()),
}; }
self.slot() >= activation_slot
} }
// only used for testing // only used for testing

View File

@ -13,11 +13,16 @@ pub mod secp256k1_program_enabled {
solana_sdk::declare_id!("E3PHP7w8kB7np3CTQ1qQ2tW3KCtjRSXBQgW9vM2mWv2Y"); solana_sdk::declare_id!("E3PHP7w8kB7np3CTQ1qQ2tW3KCtjRSXBQgW9vM2mWv2Y");
} }
pub mod consistent_recent_blockhashes_sysvar {
solana_sdk::declare_id!("3h1BQWPDS5veRsq6mDBWruEpgPxRJkfwGexg5iiQ9mYg");
}
lazy_static! { lazy_static! {
/// Map of feature identifiers to user-visible description /// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [ pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
(instructions_sysvar_enabled::id(), "instructions sysvar"), (instructions_sysvar_enabled::id(), "instructions sysvar"),
(secp256k1_program_enabled::id(), "secp256k1 program") (secp256k1_program_enabled::id(), "secp256k1 program"),
(consistent_recent_blockhashes_sysvar::id(), "consistent recentblockhashes sysvar"),
/*************** ADD NEW FEATURES HERE ***************/ /*************** ADD NEW FEATURES HERE ***************/
] ]
.iter() .iter()