Skip to content

Commit 8c14ca5

Browse files
authored
Adds accounts lt hash to bank hash details (solana-labs#3778)
1 parent 8c7ae80 commit 8c14ca5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

runtime/src/bank/bank_hash_details.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use {
1515
solana_sdk::{
1616
account::{Account, AccountSharedData, ReadableAccount},
1717
clock::{Epoch, Slot},
18+
feature_set,
1819
fee::FeeDetails,
1920
hash::Hash,
2021
inner_instruction::InnerInstructionsList,
@@ -123,6 +124,8 @@ pub struct BankHashComponents {
123124
pub last_blockhash: String,
124125
#[serde(skip_serializing_if = "Option::is_none")]
125126
pub epoch_accounts_hash: Option<String>,
127+
#[serde(skip_serializing_if = "Option::is_none")]
128+
pub accounts_lt_hash_checksum: Option<String>,
126129
pub accounts: AccountsDetails,
127130
}
128131

@@ -155,6 +158,17 @@ impl SlotDetails {
155158
epoch_accounts_hash: bank
156159
.wait_get_epoch_accounts_hash()
157160
.map(|hash| hash.as_ref().to_string()),
161+
accounts_lt_hash_checksum: bank
162+
.feature_set
163+
.is_active(&feature_set::accounts_lt_hash::id())
164+
.then(|| {
165+
bank.accounts_lt_hash
166+
.lock()
167+
.unwrap()
168+
.0
169+
.checksum()
170+
.to_string()
171+
}),
158172
accounts: AccountsDetails { accounts },
159173
})
160174
} else {
@@ -338,6 +352,11 @@ pub mod tests {
338352
} else {
339353
None
340354
},
355+
accounts_lt_hash_checksum: if slot % 3 == 0 {
356+
Some("accounts_lt_hash_checksum".into())
357+
} else {
358+
None
359+
},
341360
accounts,
342361
}),
343362
transactions: vec![],

0 commit comments

Comments
 (0)