Restore is_frozen() asserts (#6925)

This commit is contained in:
Michael Vines 2019-11-13 10:40:51 -07:00 committed by GitHub
parent 0be13a6295
commit 9026339d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 16 deletions

View File

@ -1931,10 +1931,10 @@ pub mod tests {
}; };
process_bank_0(&bank0, &blocktree, &opts).unwrap(); process_bank_0(&bank0, &blocktree, &opts).unwrap();
let bank1 = Arc::new(Bank::new_from_parent(&bank0, &Pubkey::default(), 1)); let bank1 = Arc::new(Bank::new_from_parent(&bank0, &Pubkey::default(), 1));
bank1.squash();
let slot1_entries = blocktree.get_slot_entries(1, 0, None).unwrap(); let slot1_entries = blocktree.get_slot_entries(1, 0, None).unwrap();
verify_and_process_slot_entries(&bank1, &slot1_entries, bank0.last_blockhash(), &opts) verify_and_process_slot_entries(&bank1, &slot1_entries, bank0.last_blockhash(), &opts)
.unwrap(); .unwrap();
bank1.squash();
// Test process_blocktree_from_root() from slot 1 onwards // Test process_blocktree_from_root() from slot 1 onwards
let (bank_forks, bank_forks_info, _) = let (bank_forks, bank_forks_info, _) =

View File

@ -787,12 +787,11 @@ impl Bank {
/// the oldest ones once its internal cache is full. Once boot, the /// the oldest ones once its internal cache is full. Once boot, the
/// bank will reject transactions using that `hash`. /// bank will reject transactions using that `hash`.
pub fn register_tick(&self, hash: &Hash) { pub fn register_tick(&self, hash: &Hash) {
if self.is_frozen() { assert!(
warn!("=========== TODO: register_tick() working on a frozen bank! ================"); !self.is_frozen(),
} "register_tick() working on a frozen bank!"
);
// TODO: put this assert back in
// assert!(!self.is_frozen());
inc_new_counter_debug!("bank-register_tick-registered", 1); inc_new_counter_debug!("bank-register_tick-registered", 1);
// Grab blockhash lock before incrementing tick height so that replay stage does // Grab blockhash lock before incrementing tick height so that replay stage does
// not attempt to freeze after observing the last tick and before blockhash is // not attempt to freeze after observing the last tick and before blockhash is
@ -823,11 +822,10 @@ impl Bank {
txs: &'b [Transaction], txs: &'b [Transaction],
iteration_order: Option<Vec<usize>>, iteration_order: Option<Vec<usize>>,
) -> TransactionBatch<'a, 'b> { ) -> TransactionBatch<'a, 'b> {
if self.is_frozen() { assert!(
warn!("=========== TODO: lock_accounts() working on a frozen bank! ================"); !self.is_frozen(),
} "prepare_batch() working on a frozen bank!"
// TODO: put this assert back in );
// assert!(!self.is_frozen());
let results = self let results = self
.rc .rc
.accounts .accounts
@ -1153,9 +1151,10 @@ impl Bank {
tx_count: u64, tx_count: u64,
signature_count: u64, signature_count: u64,
) -> Vec<Result<()>> { ) -> Vec<Result<()>> {
if self.is_frozen() { assert!(
warn!("=========== TODO: commit_transactions() working on a frozen bank! ================"); !self.is_frozen(),
} "commit_transactions() working on a frozen bank!"
);
self.increment_transaction_count(tx_count); self.increment_transaction_count(tx_count);
self.increment_signature_count(signature_count); self.increment_signature_count(signature_count);
@ -1167,8 +1166,6 @@ impl Bank {
self.is_delta.store(true, Ordering::Relaxed); self.is_delta.store(true, Ordering::Relaxed);
} }
// TODO: put this assert back in
// assert!(!self.is_frozen());
let mut write_time = Measure::start("write_time"); let mut write_time = Measure::start("write_time");
self.rc.accounts.store_accounts( self.rc.accounts.store_accounts(
self.slot(), self.slot(),