stake split (#6402)

* stake split

* stake split
This commit is contained in:
Rob Walker
2019-10-31 11:07:27 -07:00
committed by GitHub
parent 3a616de47b
commit bc88180058
6 changed files with 770 additions and 125 deletions

View File

@ -72,6 +72,15 @@ pub type Segment = u64;
/// some number of Slots.
pub type Epoch = u64;
#[repr(C)]
#[derive(Serialize, Deserialize, Debug, Default, PartialEq)]
pub struct Clock {
pub slot: Slot,
pub segment: Segment,
pub epoch: Epoch,
pub stakers_epoch: Epoch,
}
#[cfg(test)]
mod tests {
use super::*;

View File

@ -1,10 +1,13 @@
//! This account contains the clock slot, epoch, and stakers_epoch
//!
pub use crate::clock::Clock;
use crate::account::Account;
use crate::account_info::AccountInfo;
use crate::clock::{Epoch, Segment, Slot};
use crate::sysvar;
use crate::{
account::Account,
account_info::AccountInfo,
clock::{Epoch, Segment, Slot},
sysvar,
};
use bincode::serialized_size;
const ID: [u8; 32] = [
@ -14,15 +17,6 @@ const ID: [u8; 32] = [
crate::solana_sysvar_id!(ID, "SysvarC1ock11111111111111111111111111111111");
#[repr(C)]
#[derive(Serialize, Deserialize, Debug, Default, PartialEq)]
pub struct Clock {
pub slot: Slot,
pub segment: Segment,
pub epoch: Epoch,
pub stakers_epoch: Epoch,
}
impl Clock {
pub fn size_of() -> usize {
serialized_size(&Self::default()).unwrap() as usize