Skip to content

Commit

Permalink
Update BankHashDetails to include EpochAccountsHash (#2466)
Browse files Browse the repository at this point in the history
The EpochAccountsHash gets mixed into a Bank hash once an epoch. It is
just as important as the other items, and it was an oversight for the
field not to be included to BankHashDetails.

So, add EpochAccountsHash into BankHashDetails
  • Loading branch information
steviez authored Aug 21, 2024
1 parent 485216b commit 77b4d13
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions runtime/src/bank/bank_hash_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ pub struct BankHashComponents {
pub accounts_delta_hash: String,
pub signature_count: u64,
pub last_blockhash: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub epoch_accounts_hash: Option<String>,
pub accounts: AccountsDetails,
}

Expand Down Expand Up @@ -149,6 +151,10 @@ impl SlotDetails {
accounts_delta_hash: accounts_delta_hash.to_string(),
signature_count: bank.signature_count(),
last_blockhash: bank.last_blockhash().to_string(),
// The bank is already frozen so this should not have to wait
epoch_accounts_hash: bank
.wait_get_epoch_accounts_hash()
.map(|hash| hash.as_ref().to_string()),
accounts: AccountsDetails { accounts },
})
} else {
Expand Down Expand Up @@ -327,6 +333,11 @@ pub mod tests {
accounts_delta_hash: "accounts_delta_hash".into(),
signature_count: slot + 10,
last_blockhash: "last_blockhash".into(),
epoch_accounts_hash: if slot % 2 == 0 {
Some("epoch_accounts_hash".into())
} else {
None
},
accounts,
}),
transactions: vec![],
Expand Down

0 comments on commit 77b4d13

Please sign in to comment.