Fix bad rent in Bank::deposit as if since epoch 0 (#10468)
* Fix bad rent in Bank::deposit as if since epoch 0 * Remove redundant predicate * Rename * Start to add tests with some cleanup * Forgot to add refactor code... * Enchance test * Really fix rent timing in deposit with robust test * Simplify new behavior by disabling rent altogether
This commit is contained in:
@@ -139,8 +139,9 @@ impl Accounts {
|
||||
let (account, rent) =
|
||||
AccountsDB::load(storage, ancestors, accounts_index, key)
|
||||
.map(|(mut account, _)| {
|
||||
if message.is_writable(i) && !account.executable {
|
||||
let rent_due = rent_collector.update(&key, &mut account);
|
||||
if message.is_writable(i) {
|
||||
let rent_due = rent_collector
|
||||
.collect_from_existing_account(&key, &mut account);
|
||||
(account, rent_due)
|
||||
} else {
|
||||
(account, 0)
|
||||
@@ -735,8 +736,7 @@ impl Accounts {
|
||||
);
|
||||
if message.is_writable(i) {
|
||||
if account.rent_epoch == 0 {
|
||||
account.rent_epoch = rent_collector.epoch;
|
||||
acc.2 += rent_collector.update(&key, account);
|
||||
acc.2 += rent_collector.collect_from_created_account(&key, account);
|
||||
}
|
||||
accounts.push((key, &*account));
|
||||
}
|
||||
|
Reference in New Issue
Block a user