Refactor RentDebits to use hashmap instead of vec

This commit is contained in:
Justin Starry
2021-10-30 01:47:38 +01:00
parent d2974fcefc
commit aaccba8377
3 changed files with 178 additions and 79 deletions

View File

@@ -319,7 +319,7 @@ impl Accounts {
}
tx_rent += rent;
rent_debits.push(key, rent, account.lamports());
rent_debits.insert(key, rent, account.lamports());
account
}
@@ -505,6 +505,7 @@ impl Accounts {
nonce_rollback,
tx.message(),
&loaded_transaction.accounts,
&loaded_transaction.rent_debits,
) {
Ok(nonce_rollback) => Some(nonce_rollback),
Err(e) => return (Err(e), None),
@@ -1084,7 +1085,7 @@ impl Accounts {
loaded_transaction.rent += rent;
loaded_transaction
.rent_debits
.push(key, rent, account.lamports());
.insert(key, rent, account.lamports());
}
accounts.push((&*key, &*account));
}