From dafdc15dfef1ee64e9b7dd70eb8cf9d66430595e Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Wed, 24 Nov 2021 14:04:54 -0700 Subject: [PATCH] bank: Add failing test for `TransactionLogCollector::get_logs_for_address()` --- runtime/src/bank.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 28b0e3bbce..270fc59aa0 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -556,7 +556,7 @@ pub struct TransactionLogCollectorConfig { pub filter: TransactionLogCollectorFilter, } -#[derive(AbiExample, Clone, Debug)] +#[derive(AbiExample, Clone, Debug, PartialEq)] pub struct TransactionLogInfo { pub signature: Signature, pub result: Result<()>, @@ -15395,4 +15395,20 @@ pub(crate) mod tests { let tx = Transaction::new(&[&mint_keypair], message, genesis_config.hash()); bank.process_transaction(&tx).unwrap(); } + + #[test] + #[should_panic] + fn test_transaction_log_collector_get_logs_for_address() { + let address = Pubkey::new_unique(); + let mut mentioned_address_map = HashMap::new(); + mentioned_address_map.insert(address, vec![0]); + let transaction_log_collector = TransactionLogCollector { + mentioned_address_map, + ..TransactionLogCollector::default() + }; + assert_eq!( + transaction_log_collector.get_logs_for_address(Some(&address)), + Some(Vec::::new()), + ); + } }