From 19d86bd2b1223e127a40596e97277ebdd5b5340d Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Tue, 29 Nov 2022 15:55:07 -0600 Subject: [PATCH] add balance to cap overflow message (#28975) --- runtime/src/accounts_hash.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/src/accounts_hash.rs b/runtime/src/accounts_hash.rs index 875d4a58a0..f497f2658b 100644 --- a/runtime/src/accounts_hash.rs +++ b/runtime/src/accounts_hash.rs @@ -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',