Do not log detailed epoch stakes (#30825)

* do not log detailed epoch stakes

* allow dead code

* log stake details at trace level

* no need dead_code

* Update runtime/src/bank.rs

Co-authored-by: Brooks <brooks@prumo.org>

---------

Co-authored-by: Brooks <brooks@prumo.org>
This commit is contained in:
HaoranYi 2023-03-21 14:43:06 -05:00 committed by GitHub
parent 2216647f7e
commit d646820a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -2278,7 +2278,15 @@ impl Bank {
let stakes = self.stakes_cache.stakes().clone();
let stakes = Arc::new(StakesEnum::from(stakes));
let new_epoch_stakes = EpochStakes::new(stakes, leader_schedule_epoch);
{
info!(
"new epoch stakes, epoch: {}, total_stake: {}",
leader_schedule_epoch,
new_epoch_stakes.total_stake(),
);
// It is expensive to log the details of epoch stakes. Only log them at "trace"
// level for debugging purpose.
if log::log_enabled!(log::Level::Trace) {
let vote_stakes: HashMap<_, _> = self
.stakes_cache
.stakes()
@ -2286,12 +2294,7 @@ impl Bank {
.delegated_stakes()
.map(|(pubkey, stake)| (*pubkey, stake))
.collect();
info!(
"new epoch stakes, epoch: {}, stakes: {:#?}, total_stake: {}",
leader_schedule_epoch,
vote_stakes,
new_epoch_stakes.total_stake(),
);
trace!("new epoch stakes, stakes: {vote_stakes:#?}");
}
self.epoch_stakes
.insert(leader_schedule_epoch, new_epoch_stakes);