Skip to content

Commit 1fff4c0

Browse files
committed
cover new accounts in test
1 parent d7d7dc2 commit 1fff4c0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

svm/src/account_loader.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,6 +3060,13 @@ mod tests {
30603060
}
30613061

30623062
let mut all_accounts = mock_bank.accounts_map.keys().copied().collect::<Vec<_>>();
3063+
3064+
// append some to-be-created accounts
3065+
// this is to test that their size is 0 rather than 64
3066+
for _ in 0..32 {
3067+
all_accounts.push(Pubkey::new_unique());
3068+
}
3069+
30633070
let mut account_loader = (&mock_bank).into();
30643071

30653072
// now generate arbitrary transactions using this accounts
@@ -3112,8 +3119,9 @@ mod tests {
31123119
.collect::<AHashSet<_>>();
31133120

31143121
for pubkey in transaction.account_keys().iter() {
3115-
let account = mock_bank.accounts_map.get(pubkey).unwrap();
3116-
expected_size += TRANSACTION_ACCOUNT_BASE_SIZE + account.data().len();
3122+
if let Some(account) = mock_bank.accounts_map.get(pubkey) {
3123+
expected_size += TRANSACTION_ACCOUNT_BASE_SIZE + account.data().len();
3124+
};
31173125

31183126
if let Some((programdata_address, programdata_size)) =
31193127
programdata_tracker.get(pubkey)

0 commit comments

Comments
 (0)