From 325e1b3f0a3e878aa3dfcc0e20f31c134fe26709 Mon Sep 17 00:00:00 2001 From: Grant Wuerker Date: Sun, 18 Nov 2018 16:38:15 -0600 Subject: [PATCH] different hashes in pow store --- lighthouse/db/src/stores/pow_chain_store.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lighthouse/db/src/stores/pow_chain_store.rs b/lighthouse/db/src/stores/pow_chain_store.rs index 493df47f8..aa2b267f7 100644 --- a/lighthouse/db/src/stores/pow_chain_store.rs +++ b/lighthouse/db/src/stores/pow_chain_store.rs @@ -25,17 +25,19 @@ impl PoWChainStore { #[cfg(test)] mod tests { - extern crate rand; - + extern crate types; + use super::*; use super::super::super::MemoryDB; + use self::types::Hash256; + #[test] fn test_put_block_hash() { let db = Arc::new(MemoryDB::open()); let store = PoWChainStore::new(db.clone()); - let hash: &[u8] = &[rand::random()]; + let hash = &Hash256::from("some hash".as_bytes()).to_vec(); store.put_block_hash(hash).unwrap(); assert!(db.exists(DB_COLUMN, hash).unwrap()); @@ -46,7 +48,7 @@ mod tests { let db = Arc::new(MemoryDB::open()); let store = PoWChainStore::new(db.clone()); - let hash: &[u8] = &[rand::random()]; + let hash = &Hash256::from("some hash".as_bytes()).to_vec(); db.put(DB_COLUMN, hash, &[0]).unwrap(); assert!(store.block_hash_exists(hash).unwrap()); @@ -57,8 +59,8 @@ mod tests { let db = Arc::new(MemoryDB::open()); let store = PoWChainStore::new(db.clone()); - let hash: &[u8] = &[rand::random()]; - let other_hash: &[u8] = &[rand::random()]; + let hash = &Hash256::from("some hash".as_bytes()).to_vec(); + let other_hash = &Hash256::from("another hash".as_bytes()).to_vec(); db.put(DB_COLUMN, hash, &[0]).unwrap(); assert!(!store.block_hash_exists(other_hash).unwrap());