diff --git a/src/bank_forks.rs b/src/bank_forks.rs index d9b9fbc9b71285..6145a6d6e6fb26 100644 --- a/src/bank_forks.rs +++ b/src/bank_forks.rs @@ -98,4 +98,26 @@ mod tests { assert_eq!(bank_forks[1u64].tick_height(), 1); assert_eq!(bank_forks.working_bank().tick_height(), 1); } + + #[test] + fn test_bank_forks_frozen_banks() { + let (genesis_block, _) = GenesisBlock::new(10_000); + let bank = Bank::new(&genesis_block); + let mut bank_forks = BankForks::new(0, bank); + let child_bank = Bank::new_from_parent(&bank_forks[0u64]); + bank_forks.insert(1, child_bank); + assert!(bank_forks.frozen_banks().get(&0).is_some()); + assert!(bank_forks.frozen_banks().get(&1).is_none()); + } + + #[test] + fn test_bank_forks_active_banks() { + let (genesis_block, _) = GenesisBlock::new(10_000); + let bank = Bank::new(&genesis_block); + let mut bank_forks = BankForks::new(0, bank); + let child_bank = Bank::new_from_parent(&bank_forks[0u64]); + bank_forks.insert(1, child_bank); + assert_eq!(bank_forks.active_banks(), vec![1]); + } + }