Skip to content

Commit

Permalink
Fully remove tulip support
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Oct 29, 2024
1 parent 58b405b commit 253f422
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 827 deletions.
48 changes: 1 addition & 47 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
signature::Signature,
},
std::{
collections::{HashMap, HashSet},
collections::HashSet,
fmt, fs, io,
path::{Path, PathBuf},
time::{SystemTime, UNIX_EPOCH},
Expand Down Expand Up @@ -631,7 +631,6 @@ pub struct DbData {
sweep_stake_account: Option<SweepStakeAccount>,
transitory_sweep_stake_accounts: Vec<TransitorySweepStake>,
tax_rate: Option<TaxRate>,
validator_credit_scores: Option<HashMap<Epoch, Vec<ValidatorCreditScore>>>,
}

impl DbData {
Expand Down Expand Up @@ -681,7 +680,6 @@ impl DbData {
.get("transitory-sweep-stake-accounts")
.unwrap_or_default(),
tax_rate: None,
validator_credit_scores: None,
}
}

Expand Down Expand Up @@ -1581,50 +1579,6 @@ impl Db {
self.save()
}

pub fn contains_validator_credit_scores(&self, epoch: Epoch) -> bool {
self.data
.validator_credit_scores
.as_ref()
.and_then(|vcs| vcs.get(&epoch))
.is_some()
}

pub fn get_validator_credit_scores(&self, epoch: Epoch) -> Vec<ValidatorCreditScore> {
self.data
.validator_credit_scores
.as_ref()
.and_then(|vcs| vcs.get(&epoch))
.cloned()
.unwrap_or_default()
}

pub fn set_validator_credit_scores(
&mut self,
epoch: Epoch,
validator_credit_scores: Vec<ValidatorCreditScore>,
) -> DbResult<()> {
if self.data.validator_credit_scores.is_none() {
self.data.validator_credit_scores = Some(HashMap::default());
}

*self
.data
.validator_credit_scores
.as_mut()
.unwrap()
.entry(epoch)
.or_default() = validator_credit_scores;

// Retain the last 10 epochs
self.data
.validator_credit_scores
.as_mut()
.unwrap()
.retain(|k, _| *k >= epoch.saturating_sub(10));

self.save()
}

#[allow(clippy::too_many_arguments)]
pub fn record_transfer(
&mut self,
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub mod notifier;
pub mod priority_fee;
pub mod token;
pub mod vendor;
//pub mod tulip;

pub fn app_version() -> String {
let tag = option_env!("GITHUB_REF")
Expand Down
Loading

0 comments on commit 253f422

Please sign in to comment.