From 5239ed4e768c2e39bfaac6ceb58d7180bed0ee7f Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Mon, 13 Jul 2020 10:08:19 -0600 Subject: [PATCH] Add failing test --- runtime/src/bank.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 8719f256c4079d..58681cbdfddba1 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -6177,6 +6177,21 @@ mod tests { } } + #[test] + fn test_blockhash_queue_sysvar_consistency() { + let (genesis_config, mint_keypair) = create_genesis_config(100_000); + let mut bank = Arc::new(Bank::new(&genesis_config)); + goto_end_of_slot(Arc::get_mut(&mut bank).unwrap()); + + let bhq_account = bank.get_account(&sysvar::recent_blockhashes::id()).unwrap(); + let recent_blockhashes = + sysvar::recent_blockhashes::RecentBlockhashes::from_account(&bhq_account).unwrap(); + + let sysvar_recent_blockhash = recent_blockhashes[0].blockhash; + let bank_last_blockhash = bank.last_blockhash(); + assert_eq!(sysvar_recent_blockhash, bank_last_blockhash); + } + #[test] fn test_bank_inherit_last_vote_sync() { let (genesis_config, _) = create_genesis_config(500);