Skip to content

Commit

Permalink
chore: add dcou to apply_votes_to_tower (anza-xyz#1831)
Browse files Browse the repository at this point in the history
* add dcou to apply_votes_to_tower

* cargo sort

* fix fmt
  • Loading branch information
yihau authored Jun 24, 2024
1 parent a49bae8 commit 66bdefd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions local-cluster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ serial_test = { workspace = true }
solana-core = { workspace = true, features = ["dev-context-only-utils"] }
solana-download-utils = { workspace = true }
solana-ledger = { workspace = true, features = ["dev-context-only-utils"] }
solana-local-cluster = { path = ".", features = ["dev-context-only-utils"] }
solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }

[package.metadata.docs.rs]
Expand Down
15 changes: 10 additions & 5 deletions local-cluster/src/cluster_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use {
rand::{thread_rng, Rng},
rayon::{prelude::*, ThreadPool},
solana_client::connection_cache::{ConnectionCache, Protocol},
solana_core::consensus::{
tower_storage::{FileTowerStorage, SavedTower, SavedTowerVersions, TowerStorage},
VOTE_THRESHOLD_DEPTH,
},
solana_core::consensus::VOTE_THRESHOLD_DEPTH,
solana_entry::entry::{self, Entry, EntrySlice},
solana_gossip::{
cluster_info::{self, ClusterInfo},
Expand Down Expand Up @@ -44,7 +41,7 @@ use {
std::{
collections::{HashMap, HashSet, VecDeque},
net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener},
path::{Path, PathBuf},
path::Path,
sync::{
atomic::{AtomicBool, Ordering},
Arc, RwLock,
Expand All @@ -53,6 +50,13 @@ use {
time::{Duration, Instant},
},
};
#[cfg(feature = "dev-context-only-utils")]
use {
solana_core::consensus::tower_storage::{
FileTowerStorage, SavedTower, SavedTowerVersions, TowerStorage,
},
std::path::PathBuf,
};

pub fn get_client_facing_addr(
protocol: Protocol,
Expand Down Expand Up @@ -348,6 +352,7 @@ pub fn kill_entry_and_spend_and_verify_rest(
}
}

#[cfg(feature = "dev-context-only-utils")]
pub fn apply_votes_to_tower(node_keypair: &Keypair, votes: Vec<(Slot, Hash)>, tower_path: PathBuf) {
let tower_storage = FileTowerStorage::new(tower_path);
let mut tower = tower_storage.load(&node_keypair.pubkey()).unwrap();
Expand Down

0 comments on commit 66bdefd

Please sign in to comment.