Skip to content

Commit

Permalink
save/load prior roots values from roots_original
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Mar 3, 2022
1 parent 6270d96 commit 6118a42
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,7 @@ impl Bank {
stakes_cache: StakesCache::new(fields.stakes),
epoch_stakes: fields.epoch_stakes,
is_delta: AtomicBool::new(fields.is_delta),
prior_roots: fields.prior_roots,
prior_roots: Vec::default(),
builtin_programs: new(),
compute_budget: None,
builtin_feature_transitions: new(),
Expand All @@ -2012,6 +2012,13 @@ impl Bank {
accounts_data_len: AtomicU64::new(accounts_data_len),
fee_structure: FeeStructure::default(),
};
{
let mut writer = bank.rc.accounts.accounts_db.accounts_index.roots_tracker.write().unwrap();
for x in fields.prior_roots {
writer.roots_original.insert(x);
}
}

bank.finish_init(
genesis_config,
additional_builtins,
Expand Down Expand Up @@ -2060,6 +2067,9 @@ impl Bank {
&'a self,
ancestors: &'a HashMap<Slot, usize>,
) -> BankFieldsToSerialize<'a> {
let prior_roots = {
self.rc.accounts.accounts_db.accounts_index.roots_tracker.read().unwrap().roots_original.get_all()
};
BankFieldsToSerialize {
blockhash_queue: &self.blockhash_queue,
ancestors,
Expand Down Expand Up @@ -2091,7 +2101,7 @@ impl Bank {
stakes: &self.stakes_cache,
epoch_stakes: &self.epoch_stakes,
is_delta: self.is_delta.load(Relaxed),
prior_roots: self.prior_roots.clone(),
prior_roots,
}
}

Expand Down

0 comments on commit 6118a42

Please sign in to comment.