Document current vote program semantics

And add a new 'staker_id' VoteState member variable to offer a path to
work our way out.  Update leader scheduler to use staker_id, but
continue setting it to 'from_id' for the moment.

No functional changes here.
This commit is contained in:
Greg Fitzgerald
2019-02-01 16:35:50 -07:00
committed by Grimes
parent 0a9226ec8e
commit 511d8275d6
3 changed files with 20 additions and 4 deletions

View File

@ -50,6 +50,7 @@ pub enum VoteInstruction {
pub struct VoteState {
pub votes: VecDeque<Vote>,
pub node_id: Pubkey,
pub staker_id: Pubkey,
}
pub fn get_max_size() -> usize {
@ -61,9 +62,13 @@ pub fn get_max_size() -> usize {
}
impl VoteState {
pub fn new(node_id: Pubkey) -> Self {
pub fn new(node_id: Pubkey, staker_id: Pubkey) -> Self {
let votes = VecDeque::new();
Self { votes, node_id }
Self {
votes,
node_id,
staker_id,
}
}
pub fn deserialize(input: &[u8]) -> Result<Self, ProgramError> {