From fc396f965c1367ae9e21146cb03e382c2e0d76be Mon Sep 17 00:00:00 2001
From: Brooks Prumo <brooks@solana.com>
Date: Fri, 9 Sep 2022 16:33:12 -0400
Subject: [PATCH] Fixup log of Epoch Accounts Hash when freezing bank (#27688)

---
 runtime/src/bank.rs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs
index 6106d80508e5ec..b5811a1633c996 100644
--- a/runtime/src/bank.rs
+++ b/runtime/src/bank.rs
@@ -6837,7 +6837,8 @@ impl Bank {
         ]);
 
         let epoch_accounts_hash = self.epoch_accounts_hash();
-        if self.should_include_epoch_accounts_hash() {
+        let should_include_epoch_accounts_hash = self.should_include_epoch_accounts_hash();
+        if should_include_epoch_accounts_hash {
             // Nothing is writing a value into the epoch accounts hash yet—this is not a problem
             // for normal clusters, as the feature gating this `if` block is always false.
             // However, some tests enable all features, so this `if` block can be true.
@@ -6876,10 +6877,11 @@ impl Bank {
             self.signature_count(),
             self.last_blockhash(),
             self.capitalization(),
-            match epoch_accounts_hash {
-                None => "".to_string(),
-                Some(epoch_accounts_hash) => format!(", epoch_accounts_hash: {}", epoch_accounts_hash.as_ref()),
-            },
+            if should_include_epoch_accounts_hash {
+                format!(", epoch_accounts_hash: {:?}", epoch_accounts_hash)
+            } else {
+                "".to_string()
+            }
         );
 
         info!(