Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ serde_derive = "1.0.94"
serde_json = "1.0.40"
solana-logger = { path = "../logger", version = "0.17.0" }
solana-measure = { path = "../measure", version = "0.17.0" }
solana-merkle-tree = { path = "../merkle-tree", version = "0.17.0" }
solana-metrics = { path = "../metrics", version = "0.17.0" }
solana-bpf-loader-api = { path = "../programs/bpf_loader_api", version = "0.17.0" }
solana-bpf-loader-program = { path = "../programs/bpf_loader_program", version = "0.17.0" }
Expand Down
10 changes: 4 additions & 6 deletions runtime/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::message_processor::has_duplicates;
use bincode::serialize;
use log::*;
use rayon::slice::ParallelSliceMut;
use solana_merkle_tree::MerkleTree;
use solana_metrics::inc_new_counter_error;
use solana_sdk::account::Account;
use solana_sdk::hash::{Hash, Hasher};
Expand Down Expand Up @@ -502,7 +503,7 @@ impl Accounts {
pub fn hash_internal_state(&self, fork_id: Fork) -> Option<Hash> {
let account_hashes = self.scan_fork(fork_id, |stored_account| {
if !sysvar::check_id(&stored_account.balance.owner) {
Some(Self::hash_account(stored_account))
Some([&serialize(&stored_account.balance).unwrap(), stored_account.data].concat())
} else {
None
}
Expand All @@ -511,11 +512,8 @@ impl Accounts {
if account_hashes.is_empty() {
None
} else {
let mut hasher = Hasher::default();
for hash in account_hashes {
hasher.hash(hash.as_ref());
}
Some(hasher.result())
let merkle_tree = MerkleTree::new(&account_hashes);
merkle_tree.get_root().and_then(|h| Some(*h))
}
}

Expand Down