add balance to cap overflow message (#28975)

This commit is contained in:
Jeff Washington (jwash) 2022-11-29 15:55:07 -06:00 committed by GitHub
parent 99d8929ab4
commit 19d86bd2b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -706,9 +706,12 @@ impl AccountsHasher {
}
pub fn checked_cast_for_capitalization(balance: u128) -> u64 {
balance
.try_into()
.expect("overflow is detected while summing capitalization")
balance.try_into().unwrap_or_else(|_| {
panic!(
"overflow is detected while summing capitalization: {}",
balance
)
})
}
/// return references to cache hash data, grouped by bin, sourced from 'sorted_data_by_pubkey',