* 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
(cherry picked from commit 6c242f3fec
)
# Conflicts:
# runtime/src/accounts.rs
# runtime/src/rent_collector.rs
* Fix conflict
* Fix clippy
Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
This commit is contained in:
@@ -155,8 +155,9 @@ impl Accounts {
|
||||
let (account, rent) =
|
||||
AccountsDB::load(storage, ancestors, accounts_index, key)
|
||||
.and_then(|(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);
|
||||
Some((account, rent_due))
|
||||
} else {
|
||||
Some((account, 0))
|
||||
@@ -751,8 +752,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