From 9330682b8d32dccc066aa14633ecf8724d8431e5 Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Tue, 26 Feb 2019 13:59:39 -0800 Subject: [PATCH] Squash test to test parent bank after squash --- runtime/src/bank.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 1b3a70820677ef..6582e88294eec7 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -1450,4 +1450,20 @@ mod tests { bank.squash(); } } + + #[test] + fn test_bank_get_account_in_parent_after_squash() { + let (genesis_block, mint_keypair) = GenesisBlock::new(500); + let parent = Arc::new(Bank::new(&genesis_block)); + + let key1 = Keypair::new(); + + parent + .transfer(1, &mint_keypair, key1.pubkey(), genesis_block.last_id()) + .unwrap(); + assert_eq!(parent.get_balance(&key1.pubkey()), 1); + let bank = Bank::new_from_parent(&parent); + bank.squash(); + assert_eq!(parent.get_balance(&key1.pubkey()), 1); + } }