Initialize BlockCommitmentCache slot and root on node boot (#11178)

* Initialize commitment-cache slot and root on node boot

* Ignore long tests
This commit is contained in:
Tyera Eulberg 2020-07-23 11:44:57 -06:00 committed by GitHub
parent b60ff70657
commit b5a6a2f461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -270,7 +270,9 @@ impl Validator {
} }
let cluster_info = Arc::new(ClusterInfo::new(node.info.clone(), keypair.clone())); let cluster_info = Arc::new(ClusterInfo::new(node.info.clone(), keypair.clone()));
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default())); let mut block_commitment_cache = BlockCommitmentCache::default();
block_commitment_cache.initialize_slots(bank.slot());
let block_commitment_cache = Arc::new(RwLock::new(block_commitment_cache));
let subscriptions = Arc::new(RpcSubscriptions::new( let subscriptions = Arc::new(RpcSubscriptions::new(
&exit, &exit,

View File

@ -472,6 +472,7 @@ fn run_kill_partition_switch_threshold<F>(
} }
#[test] #[test]
#[ignore]
#[serial] #[serial]
fn test_kill_partition_switch_threshold_no_progress() { fn test_kill_partition_switch_threshold_no_progress() {
let max_switch_threshold_failure_pct = 1.0 - 2.0 * SWITCH_FORK_THRESHOLD; let max_switch_threshold_failure_pct = 1.0 - 2.0 * SWITCH_FORK_THRESHOLD;
@ -500,6 +501,7 @@ fn test_kill_partition_switch_threshold_no_progress() {
} }
#[test] #[test]
#[ignore]
#[serial] #[serial]
fn test_kill_partition_switch_threshold() { fn test_kill_partition_switch_threshold() {
let max_switch_threshold_failure_pct = 1.0 - 2.0 * SWITCH_FORK_THRESHOLD; let max_switch_threshold_failure_pct = 1.0 - 2.0 * SWITCH_FORK_THRESHOLD;

View File

@ -187,6 +187,11 @@ impl BlockCommitmentCache {
pub fn set_highest_confirmed_root(&mut self, root: Slot) { pub fn set_highest_confirmed_root(&mut self, root: Slot) {
self.commitment_slots.highest_confirmed_root = root; self.commitment_slots.highest_confirmed_root = root;
} }
pub fn initialize_slots(&mut self, slot: Slot) {
self.commitment_slots.slot = slot;
self.commitment_slots.root = slot;
}
} }
#[derive(Default, Clone, Copy)] #[derive(Default, Clone, Copy)]