Rework validator vote account defaults to half voting fees

This commit is contained in:
Michael Vines
2020-03-13 11:41:18 -07:00
parent 5c2cf04e10
commit 29fb79382c
20 changed files with 140 additions and 134 deletions

View File

@@ -678,10 +678,10 @@ pub fn process_vote<S: std::hash::BuildHasher>(
vote_account.set_state(&VoteStateVersions::Current(Box::new(vote_state)))
}
// utility function, used by Bank, tests
pub fn create_account(
vote_pubkey: &Pubkey,
pub fn create_account_with_authorized(
node_pubkey: &Pubkey,
authorized_voter: &Pubkey,
authorized_withdrawer: &Pubkey,
commission: u8,
lamports: u64,
) -> Account {
@@ -690,8 +690,8 @@ pub fn create_account(
let vote_state = VoteState::new(
&VoteInit {
node_pubkey: *node_pubkey,
authorized_voter: *vote_pubkey,
authorized_withdrawer: *vote_pubkey,
authorized_voter: *authorized_voter,
authorized_withdrawer: *authorized_withdrawer,
commission,
},
&Clock::default(),
@@ -703,6 +703,16 @@ pub fn create_account(
vote_account
}
// create_account() should be removed, use create_account_with_authorized() instead
pub fn create_account(
vote_pubkey: &Pubkey,
node_pubkey: &Pubkey,
commission: u8,
lamports: u64,
) -> Account {
create_account_with_authorized(node_pubkey, vote_pubkey, vote_pubkey, commission, lamports)
}
#[cfg(test)]
mod tests {
use super::*;