Skip to content

Commit

Permalink
bank: don't panic when getting logs from malformed TransactionLogColl…
Browse files Browse the repository at this point in the history
…ector
  • Loading branch information
t-nelson authored and mergify[bot] committed Nov 25, 2021
1 parent dafdc15 commit e558ad4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,12 @@ impl TransactionLogCollector {
) -> Option<Vec<TransactionLogInfo>> {
match address {
None => Some(self.logs.clone()),
Some(address) => self
.mentioned_address_map
.get(address)
.map(|log_indices| log_indices.iter().map(|i| self.logs[*i].clone()).collect()),
Some(address) => self.mentioned_address_map.get(address).map(|log_indices| {
log_indices
.iter()
.filter_map(|i| self.logs.get(*i).cloned())
.collect()
}),
}
}
}
Expand Down Expand Up @@ -15397,7 +15399,6 @@ pub(crate) mod tests {
}

#[test]
#[should_panic]
fn test_transaction_log_collector_get_logs_for_address() {
let address = Pubkey::new_unique();
let mut mentioned_address_map = HashMap::new();
Expand Down

0 comments on commit e558ad4

Please sign in to comment.