different hashes in pow store

This commit is contained in:
Grant Wuerker 2018-11-18 16:38:15 -06:00
parent 9148c20630
commit 325e1b3f0a

View File

@ -25,17 +25,19 @@ impl<T: ClientDB> PoWChainStore<T> {
#[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());