Check bank capitalization (#11927)

* Check bank capitalization

* Simplify and unify capitalization calculation

* Improve and add tests

* Avoid overflow and inhibit automatic restart

* Fix test

* Tweak checked sum for cap. and add tests

* Fix broken build after merge conflicts..

* Rename to ClusterType

* Rename confusing method

* Clarify comment

* Verify cap. in rent and inflation tests

Co-authored-by: Stephen Akridge <sakridge@gmail.com>
This commit is contained in:
Ryo Onodera
2020-09-12 01:48:06 +09:00
committed by GitHub
parent f27665662c
commit de4a613610
12 changed files with 360 additions and 98 deletions

View File

@ -202,10 +202,6 @@ impl GenesisConfig {
self.native_instruction_processors.push((name, program_id));
}
pub fn add_rewards_pool(&mut self, pubkey: Pubkey, account: Account) {
self.rewards_pools.insert(pubkey, account);
}
pub fn hashes_per_tick(&self) -> Option<u64> {
self.poh_config.hashes_per_tick
}
@ -244,6 +240,8 @@ impl fmt::Display for GenesisConfig {
{:?}\n\
{:?}\n\
Capitalization: {} SOL in {} accounts\n\
Native instruction processors: {:#?}\n\
Rewards pool: {:#?}\n\
",
Utc.timestamp(self.creation_time, 0).to_rfc3339(),
self.cluster_type,
@ -272,6 +270,8 @@ impl fmt::Display for GenesisConfig {
.sum::<u64>()
),
self.accounts.len(),
self.native_instruction_processors,
self.rewards_pools,
)
}
}