Allow fork choice to support multiple versions of a slot (#16266)
This commit is contained in:
@ -2127,6 +2127,10 @@ impl Bank {
|
||||
self.parent_slot
|
||||
}
|
||||
|
||||
pub fn parent_hash(&self) -> Hash {
|
||||
self.parent_hash
|
||||
}
|
||||
|
||||
fn process_genesis_config(&mut self, genesis_config: &GenesisConfig) {
|
||||
// Bootstrap validator collects fees until `new_from_parent` is called.
|
||||
self.fee_rate_governor = genesis_config.fee_rate_governor.clone();
|
||||
|
@ -6,7 +6,7 @@ use crate::{
|
||||
};
|
||||
use log::*;
|
||||
use solana_metrics::inc_new_counter_info;
|
||||
use solana_sdk::{clock::Slot, timing};
|
||||
use solana_sdk::{clock::Slot, hash::Hash, timing};
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap, HashSet},
|
||||
ops::Index,
|
||||
@ -106,6 +106,17 @@ impl BankForks {
|
||||
self.banks.get(&bank_slot)
|
||||
}
|
||||
|
||||
pub fn get_with_checked_hash(
|
||||
&self,
|
||||
(bank_slot, expected_hash): (Slot, Hash),
|
||||
) -> Option<&Arc<Bank>> {
|
||||
let maybe_bank = self.banks.get(&bank_slot);
|
||||
if let Some(bank) = maybe_bank {
|
||||
assert_eq!(bank.hash(), expected_hash);
|
||||
}
|
||||
maybe_bank
|
||||
}
|
||||
|
||||
pub fn root_bank(&self) -> Arc<Bank> {
|
||||
self[self.root()].clone()
|
||||
}
|
||||
|
Reference in New Issue
Block a user