Disable rent in flaky test (#12658)

* Disable rent in test

Co-authored-by: Carl Lin <carl@solana.com>
This commit is contained in:
carllin 2020-10-03 12:44:03 -07:00 committed by GitHub
parent 026e7de819
commit adf6f748c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -2396,6 +2396,14 @@ impl AccountsDB {
}
}
}
#[cfg(test)]
pub fn get_append_vec_id(&self, pubkey: &Pubkey, slot: Slot) -> Option<AppendVecId> {
let ancestors = vec![(slot, 1)].into_iter().collect();
let accounts_index = self.accounts_index.read().unwrap();
let result = accounts_index.get(&pubkey, Some(&ancestors), None);
result.map(|(list, index)| list[index].1.store_id)
}
}
#[cfg(test)]

View File

@ -9333,7 +9333,25 @@ mod tests {
&Pubkey::default(),
),
);
assert_ne!(
bank1
.rc
.accounts
.accounts_db
.get_append_vec_id(&large_account_pubkey, 1)
.unwrap(),
bank1
.rc
.accounts
.accounts_db
.get_append_vec_id(&zero_lamport_pubkey, 1)
.unwrap()
);
// Make sure rent collection doesn't overwrite `large_account_pubkey`, which
// keeps slot 1 alive in the accounts database. Otherwise, slot 1 and it's bank
// hash would be removed from accounts, preventing `rehash()` from succeeding
bank1.lazy_rent_collection.store(true, Relaxed);
bank1.freeze();
let bank1_hash = bank1.hash();