Skip to content

Commit

Permalink
removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacholme7 committed Dec 11, 2024
1 parent e99b7ef commit 05650ab
Showing 1 changed file with 1 addition and 95 deletions.
96 changes: 1 addition & 95 deletions anchor/database/src/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl TestFixture {

Self {
db,
cluster: generators::cluster::random(0), // Empty cluster
cluster: generators::cluster::random(0),
operators: Vec::new(),
path: db_path,
_temp_dir: temp_dir,
Expand All @@ -76,10 +76,6 @@ pub mod generators {
pub mod operator {
use super::*;

pub fn random() -> Operator {
with_id(rand::thread_rng().gen())
}

pub fn with_id(id: u64) -> Operator {
let priv_key = Rsa::generate(RSA_KEY_SIZE).expect("Failed to generate RSA key");
let public_key = priv_key
Expand Down Expand Up @@ -425,93 +421,3 @@ pub mod assertions {
);
}
}

pub mod debug {
use super::*;
pub fn debug_print_db(db: &NetworkDatabase) {
let conn = db.connection().unwrap();

println!("\n=== CLUSTERS ===");
let mut stmt = conn.prepare("SELECT * FROM clusters").unwrap();
let clusters = stmt
.query_map([], |row| {
Ok(format!(
"Cluster ID: {}, Faulty: {}, Liquidated: {}",
row.get::<_, i64>(0).unwrap(),
row.get::<_, i64>(1).unwrap(),
row.get::<_, bool>(2).unwrap()
))
})
.unwrap();
for cluster in clusters {
println!("{}", cluster.unwrap());
}

println!("\n=== OPERATORS ===");
let mut stmt = conn.prepare("SELECT * FROM operators").unwrap();
let operators = stmt
.query_map([], |row| {
Ok(format!(
"Operator ID: {}, PublicKey: {}, Owner: {}",
row.get::<_, i64>(0).unwrap(),
row.get::<_, String>(1).unwrap(),
row.get::<_, String>(2).unwrap()
))
})
.unwrap();
for operator in operators {
println!("{}", operator.unwrap());
}

println!("\n=== CLUSTER MEMBERS ===");
let mut stmt = conn.prepare("SELECT * FROM cluster_members").unwrap();
let members = stmt
.query_map([], |row| {
Ok(format!(
"Cluster ID: {}, Operator ID: {}",
row.get::<_, i64>(0).unwrap(),
row.get::<_, i64>(1).unwrap()
))
})
.unwrap();
for member in members {
println!("{}", member.unwrap());
}

println!("\n=== VALIDATORS ===");
let mut stmt = conn.prepare("SELECT * FROM validators").unwrap();
let validators = stmt
.query_map([], |row| {
Ok(format!(
"Pubkey: {}, Cluster ID: {}, Fee Recipient: {:?}, Owner: {:?}, Graffiti: {:?}, Index: {:?}",
row.get::<_, String>(0).unwrap(),
row.get::<_, i64>(1).unwrap(),
row.get::<_, Option<String>>(2).unwrap(),
row.get::<_, Option<String>>(3).unwrap(),
row.get::<_, Vec<u8>>(4).unwrap(),
row.get::<_, Option<i64>>(5).unwrap()
))
})
.unwrap();
for validator in validators {
println!("{}", validator.unwrap());
}

println!("\n=== SHARES ===");
let mut stmt = conn.prepare("SELECT * FROM shares").unwrap();
let shares = stmt
.query_map([], |row| {
Ok(format!(
"Validator Pubkey: {}, Cluster ID: {}, Operator ID: {}, Share Pubkey: {:?}",
row.get::<_, String>(0).unwrap(),
row.get::<_, i64>(1).unwrap(),
row.get::<_, i64>(2).unwrap(),
row.get::<_, Option<String>>(3).unwrap()
))
})
.unwrap();
for share in shares {
println!("{}", share.unwrap());
}
}
}

0 comments on commit 05650ab

Please sign in to comment.