Revert "Use BlockCommitmentCache for RPC slots (#11103)" (#11122)

This reverts commit 815b0f31b4.
This commit is contained in:
Michael Vines
2020-07-18 16:39:12 -07:00
committed by GitHub
parent b9c29c3263
commit d19cd3a18a
2 changed files with 19 additions and 45 deletions

View File

@ -1,4 +1,4 @@
use solana_sdk::{clock::Slot, commitment_config::CommitmentLevel};
use solana_sdk::clock::Slot;
use solana_vote_program::vote_state::MAX_LOCKOUT_HISTORY;
use std::collections::HashMap;
@ -103,22 +103,6 @@ impl BlockCommitmentCache {
self.commitment_slots
}
pub fn highest_gossip_confirmed_slot(&self) -> Slot {
// TODO: see solana_core::RpcSubscriptions:
//self.last_checked_slots.get(&CommitmentLevel::SingleGossip).unwrap_or(&0)
self.highest_confirmed_slot
}
pub fn slot_with_commitment(&self, commitment_level: CommitmentLevel) -> Slot {
match commitment_level {
CommitmentLevel::Recent => self.slot(),
CommitmentLevel::Root => self.root(),
CommitmentLevel::Single => self.highest_confirmed_slot(),
CommitmentLevel::SingleGossip => self.highest_gossip_confirmed_slot(),
CommitmentLevel::Max => self.highest_confirmed_root(),
}
}
fn highest_slot_with_confirmation_count(&self, confirmation_count: usize) -> Slot {
assert!(confirmation_count > 0 && confirmation_count <= MAX_LOCKOUT_HISTORY);
for slot in (self.root()..self.slot()).rev() {