Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,7 @@ impl Bank {
&self,
vote_account_hashmap: &HashMap<Pubkey, (u64, Account)>,
rent_to_be_distributed: u64,
) {
) -> u64 {
let mut total_staked = 0;
let mut rent_distributed_in_initial_round = 0;

Expand Down Expand Up @@ -2083,6 +2083,7 @@ impl Bank {
account.lamports += rent_to_be_paid;
self.store_account(&pubkey, &account);
});
leftover_lamports
}

fn distribute_rent(&self) {
Expand All @@ -2100,7 +2101,12 @@ 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);
if leftover != 0 {
warn!("There was leftover from rent distribution: {}", leftover);
self.capitalization.fetch_sub(leftover, Ordering::Relaxed);
}
}

fn collect_rent(
Expand Down
18 changes: 17 additions & 1 deletion runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ use fs_extra::dir::CopyOptions;
use log::*;
use regex::Regex;
use solana_measure::measure::Measure;
use solana_sdk::{clock::Slot, genesis_config::GenesisConfig, hash::Hash, pubkey::Pubkey};
use solana_sdk::{
clock::Slot,
genesis_config::{ClusterType, GenesisConfig},
hash::Hash,
pubkey::Pubkey,
};
use std::{
cmp::Ordering,
fmt,
Expand Down Expand Up @@ -591,6 +596,17 @@ pub fn bank_from_archive<P: AsRef<Path>>(
if !bank.verify_snapshot_bank() {
panic!("Snapshot bank for slot {} failed to verify", bank.slot());
}
if genesis_config.cluster_type == ClusterType::Testnet {
let old = bank.set_capitalization();
if old != bank.capitalization() {
warn!(
"Capitalization was recalculated: {} => {}",
old,
bank.capitalization()
)
}
}

measure.stop();
info!("{}", measure);

Expand Down