From f6a123f279c1c40034e3445b9f385d635669da3e Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Tue, 8 Sep 2020 22:24:18 +0900 Subject: [PATCH] Reduce cap by rent's leftover as temporary measure --- runtime/src/bank.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 8c33570ca199ed..f3542d91c45aec 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -2026,7 +2026,7 @@ impl Bank { &self, vote_account_hashmap: &HashMap, rent_to_be_distributed: u64, - ) { + ) -> u64 { let mut total_staked = 0; let mut rent_distributed_in_initial_round = 0; @@ -2082,6 +2082,7 @@ impl Bank { account.lamports += rent_to_be_paid; self.store_account(&pubkey, &account); }); + leftover_lamports } fn distribute_rent(&self) { @@ -2099,7 +2100,9 @@ impl Bank { return; } - self.distribute_rent_to_validators(&self.vote_accounts(), rent_to_be_distributed); + let leftover = + self.distribute_rent_to_validators(&self.vote_accounts(), rent_to_be_distributed); + self.capitalization.fetch_sub(leftover, Ordering::Relaxed); } fn collect_rent(