more validator tests
This commit is contained in:
parent
7dd16215f4
commit
f64aa9e192
@ -273,7 +273,7 @@ mod tests {
|
|||||||
let mut s = SszStream::new();
|
let mut s = SszStream::new();
|
||||||
s.append(&block);
|
s.append(&block);
|
||||||
let ssz = s.drain();
|
let ssz = s.drain();
|
||||||
bs.put_serialized_block(&hashes[i].to_vec(), &ssz).unwrap();
|
db.put(DB_COLUMN, &hashes[i].to_vec(), &ssz).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let tuple = bs.block_at_slot(&hashes[4], 5).unwrap().unwrap();
|
let tuple = bs.block_at_slot(&hashes[4], 5).unwrap().unwrap();
|
||||||
|
@ -82,6 +82,25 @@ mod tests {
|
|||||||
use super::super::bls::Keypair;
|
use super::super::bls::Keypair;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_prefix_bytes() {
|
||||||
|
let db = Arc::new(MemoryDB::open());
|
||||||
|
let store = ValidatorStore::new(db.clone());
|
||||||
|
|
||||||
|
assert_eq!(store.prefix_bytes(&KeyPrefixes::PublicKey), b"pubkey".to_vec());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_get_db_key_for_index() {
|
||||||
|
let db = Arc::new(MemoryDB::open());
|
||||||
|
let store = ValidatorStore::new(db.clone());
|
||||||
|
|
||||||
|
let mut buf = BytesMut::with_capacity(6 + 8);
|
||||||
|
buf.put(b"pubkey".to_vec());
|
||||||
|
buf.put_u64_be(42);
|
||||||
|
assert_eq!(store.get_db_key_for_index(&KeyPrefixes::PublicKey, 42), buf.take().to_vec())
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_put_public_key_by_index() {
|
fn test_put_public_key_by_index() {
|
||||||
let db = Arc::new(MemoryDB::open());
|
let db = Arc::new(MemoryDB::open());
|
||||||
|
Loading…
Reference in New Issue
Block a user