Skip to content

Commit

Permalink
Adds accounts lt hash to bank hash details (#3778)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Nov 26, 2024
1 parent 8c7ae80 commit 8c14ca5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions runtime/src/bank/bank_hash_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use {
solana_sdk::{
account::{Account, AccountSharedData, ReadableAccount},
clock::{Epoch, Slot},
feature_set,
fee::FeeDetails,
hash::Hash,
inner_instruction::InnerInstructionsList,
Expand Down Expand Up @@ -123,6 +124,8 @@ pub struct BankHashComponents {
pub last_blockhash: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub epoch_accounts_hash: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub accounts_lt_hash_checksum: Option<String>,
pub accounts: AccountsDetails,
}

Expand Down Expand Up @@ -155,6 +158,17 @@ impl SlotDetails {
epoch_accounts_hash: bank
.wait_get_epoch_accounts_hash()
.map(|hash| hash.as_ref().to_string()),
accounts_lt_hash_checksum: bank
.feature_set
.is_active(&feature_set::accounts_lt_hash::id())
.then(|| {
bank.accounts_lt_hash
.lock()
.unwrap()
.0
.checksum()
.to_string()
}),
accounts: AccountsDetails { accounts },
})
} else {
Expand Down Expand Up @@ -338,6 +352,11 @@ pub mod tests {
} else {
None
},
accounts_lt_hash_checksum: if slot % 3 == 0 {
Some("accounts_lt_hash_checksum".into())
} else {
None
},
accounts,
}),
transactions: vec![],
Expand Down

0 comments on commit 8c14ca5

Please sign in to comment.