Add zero method to ValidatorRecord
This commit is contained in:
parent
b1b2337ec3
commit
b1066509c1
@ -1,7 +1,11 @@
|
|||||||
|
extern crate rand;
|
||||||
|
|
||||||
use super::utils::types::{ Sha256Digest, Address, U256 };
|
use super::utils::types::{ Sha256Digest, Address, U256 };
|
||||||
use super::utils::bls::PublicKey;
|
use super::utils::bls::{ PublicKey, Keypair };
|
||||||
use super::rlp::{ RlpStream, Encodable };
|
use super::rlp::{ RlpStream, Encodable };
|
||||||
|
|
||||||
|
use self::rand::thread_rng;
|
||||||
|
|
||||||
pub struct ValidatorRecord {
|
pub struct ValidatorRecord {
|
||||||
pub pubkey: PublicKey,
|
pub pubkey: PublicKey,
|
||||||
pub withdrawal_shard: u16,
|
pub withdrawal_shard: u16,
|
||||||
@ -29,6 +33,19 @@ impl ValidatorRecord {
|
|||||||
switch_dynasty
|
switch_dynasty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn zero_with_thread_rand_pub_key() -> Self {
|
||||||
|
let mut rng = thread_rng();
|
||||||
|
let keypair = Keypair::generate(&mut rng);
|
||||||
|
Self {
|
||||||
|
pubkey: keypair.public,
|
||||||
|
withdrawal_shard: 0,
|
||||||
|
withdrawal_address: Address::zero(),
|
||||||
|
randao_commitment: Sha256Digest::zero(),
|
||||||
|
balance: U256::zero(),
|
||||||
|
switch_dynasty: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user