* Reduce cap by rent's leftover as temporary measure
* Reset testnet cap. on start and more logs
(cherry picked from commit 5b2442d54e
)
Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
This commit is contained in:
@ -2026,7 +2026,7 @@ impl Bank {
|
|||||||
&self,
|
&self,
|
||||||
vote_account_hashmap: &HashMap<Pubkey, (u64, Account)>,
|
vote_account_hashmap: &HashMap<Pubkey, (u64, Account)>,
|
||||||
rent_to_be_distributed: u64,
|
rent_to_be_distributed: u64,
|
||||||
) {
|
) -> u64 {
|
||||||
let mut total_staked = 0;
|
let mut total_staked = 0;
|
||||||
let mut rent_distributed_in_initial_round = 0;
|
let mut rent_distributed_in_initial_round = 0;
|
||||||
|
|
||||||
@ -2082,6 +2082,7 @@ impl Bank {
|
|||||||
account.lamports += rent_to_be_paid;
|
account.lamports += rent_to_be_paid;
|
||||||
self.store_account(&pubkey, &account);
|
self.store_account(&pubkey, &account);
|
||||||
});
|
});
|
||||||
|
leftover_lamports
|
||||||
}
|
}
|
||||||
|
|
||||||
fn distribute_rent(&self) {
|
fn distribute_rent(&self) {
|
||||||
@ -2099,7 +2100,12 @@ impl Bank {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let leftover =
|
||||||
self.distribute_rent_to_validators(&self.vote_accounts(), rent_to_be_distributed);
|
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(
|
fn collect_rent(
|
||||||
|
@ -14,7 +14,12 @@ use fs_extra::dir::CopyOptions;
|
|||||||
use log::*;
|
use log::*;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use solana_measure::measure::Measure;
|
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::{
|
use std::{
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
fmt,
|
fmt,
|
||||||
@ -585,6 +590,17 @@ pub fn bank_from_archive<P: AsRef<Path>>(
|
|||||||
if !bank.verify_snapshot_bank() {
|
if !bank.verify_snapshot_bank() {
|
||||||
panic!("Snapshot bank for slot {} failed to verify", bank.slot());
|
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();
|
measure.stop();
|
||||||
info!("{}", measure);
|
info!("{}", measure);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user