Rename largest_confirmed_root to highest_confirmed_root (#10947)

This commit is contained in:
Greg Fitzgerald
2020-07-07 17:59:46 -06:00
committed by GitHub
parent d492f4f15b
commit 2fdbb97244
8 changed files with 45 additions and 45 deletions

View File

@ -184,7 +184,7 @@ impl BankForks {
&mut self,
root: Slot,
accounts_package_sender: &Option<AccountsPackageSender>,
largest_confirmed_root: Option<Slot>,
highest_confirmed_root: Option<Slot>,
) {
let old_epoch = self.root_bank().epoch();
self.root = root;
@ -261,7 +261,7 @@ impl BankForks {
}
let new_tx_count = root_bank.transaction_count();
self.prune_non_root(root, largest_confirmed_root);
self.prune_non_root(root, highest_confirmed_root);
inc_new_counter_info!(
"bank-forks_set_root_ms",
@ -338,13 +338,13 @@ impl BankForks {
Ok(())
}
fn prune_non_root(&mut self, root: Slot, largest_confirmed_root: Option<Slot>) {
fn prune_non_root(&mut self, root: Slot, highest_confirmed_root: Option<Slot>) {
let descendants = self.descendants();
self.banks.retain(|slot, _| {
*slot == root
|| descendants[&root].contains(slot)
|| (*slot < root
&& *slot >= largest_confirmed_root.unwrap_or(root)
&& *slot >= highest_confirmed_root.unwrap_or(root)
&& descendants[slot].contains(&root))
});
datapoint_debug!(

View File

@ -39,7 +39,7 @@ impl BlockCommitment {
#[derive(Default)]
pub struct BlockCommitmentCache {
block_commitment: HashMap<Slot, BlockCommitment>,
largest_confirmed_root: Slot,
highest_confirmed_root: Slot,
total_stake: u64,
bank: Arc<Bank>,
root: Slot,
@ -63,7 +63,7 @@ impl std::fmt::Debug for BlockCommitmentCache {
impl BlockCommitmentCache {
pub fn new(
block_commitment: HashMap<Slot, BlockCommitment>,
largest_confirmed_root: Slot,
highest_confirmed_root: Slot,
total_stake: u64,
bank: Arc<Bank>,
root: Slot,
@ -71,7 +71,7 @@ impl BlockCommitmentCache {
) -> Self {
Self {
block_commitment,
largest_confirmed_root,
highest_confirmed_root,
total_stake,
bank,
root,
@ -83,8 +83,8 @@ impl BlockCommitmentCache {
self.block_commitment.get(&slot)
}
pub fn largest_confirmed_root(&self) -> Slot {
self.largest_confirmed_root
pub fn highest_confirmed_root(&self) -> Slot {
self.highest_confirmed_root
}
pub fn total_stake(&self) -> u64 {
@ -159,15 +159,15 @@ impl BlockCommitmentCache {
Self {
block_commitment,
total_stake: 42,
largest_confirmed_root: root,
highest_confirmed_root: root,
bank,
root,
highest_confirmed_slot: root,
}
}
pub fn set_largest_confirmed_root(&mut self, root: Slot) {
self.largest_confirmed_root = root;
pub fn set_highest_confirmed_root(&mut self, root: Slot) {
self.highest_confirmed_root = root;
}
}