Skip to content

Commit

Permalink
Adds datapoint if rent collection changes only the rent epoch (#2922)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo committed Sep 19, 2024
1 parent c1b465d commit 33167a3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4322,8 +4322,8 @@ impl Bank {
let rent_epoch_post = account.rent_epoch();

// did the account change in any way due to rent collection?
let account_changed =
rent_collected_info.rent_amount != 0 || rent_epoch_post != rent_epoch_pre;
let rent_epoch_changed = rent_epoch_post != rent_epoch_pre;
let account_changed = rent_collected_info.rent_amount != 0 || rent_epoch_changed;

// always store the account, regardless if it changed or not
let always_store_accounts =
Expand Down Expand Up @@ -4361,6 +4361,17 @@ impl Bank {
);
}
}
} else {
debug_assert_eq!(rent_collected_info.rent_amount, 0);
if rent_epoch_changed {
datapoint_info!(
"bank-rent_collection_updated_only_rent_epoch",
("slot", self.slot(), i64),
("pubkey", pubkey.to_string(), String),
("rent_epoch_pre", rent_epoch_pre, i64),
("rent_epoch_post", rent_epoch_post, i64),
);
}
}
total_rent_collected_info += rent_collected_info;
accounts_to_store.push((pubkey, account));
Expand Down

0 comments on commit 33167a3

Please sign in to comment.