fix single node testnet, remove bootstrap vote (#5534)

This commit is contained in:
Rob Walker
2019-08-15 18:58:46 -07:00
committed by GitHub
parent 4ee212ae4c
commit 94f1132fb6
7 changed files with 34 additions and 58 deletions

View File

@ -6,7 +6,7 @@ use solana_sdk::{
signature::{Keypair, KeypairUtil},
system_program,
};
use solana_stake_api;
use solana_stake_api::stake_state;
use solana_vote_api::vote_state;
// The default stake placed with the bootstrap leader
@ -32,15 +32,20 @@ pub fn create_genesis_block_with_leader(
let voting_keypair = Keypair::new();
let staking_keypair = Keypair::new();
// TODO: de-duplicate the stake once passive staking
// is fully implemented
let (vote_account, vote_state) = vote_state::create_bootstrap_leader_account(
// TODO: de-duplicate the stake... passive staking is fully implemented
let vote_account = vote_state::create_account(
&voting_keypair.pubkey(),
&bootstrap_leader_pubkey,
0,
bootstrap_leader_stake_lamports,
);
let stake_account = stake_state::create_account(
&voting_keypair.pubkey(),
&vote_account,
bootstrap_leader_stake_lamports,
);
let mut builder = Builder::new()
.accounts(&[
// the mint
@ -57,14 +62,7 @@ pub fn create_genesis_block_with_leader(
// where votes go to
(voting_keypair.pubkey(), vote_account),
// passive bootstrap leader stake, duplicates above temporarily
(
staking_keypair.pubkey(),
solana_stake_api::stake_state::create_stake_account(
&voting_keypair.pubkey(),
&vote_state,
bootstrap_leader_stake_lamports,
),
),
(staking_keypair.pubkey(), stake_account),
])
// Bare minimum program set
.native_instruction_processors(&[

View File

@ -222,7 +222,11 @@ pub mod tests {
pub fn create_stake_account(stake: u64, vote_pubkey: &Pubkey) -> (Pubkey, Account) {
(
Pubkey::new_rand(),
stake_state::create_stake_account(&vote_pubkey, &VoteState::default(), stake),
stake_state::create_account(
&vote_pubkey,
&vote_state::create_account(&vote_pubkey, &Pubkey::new_rand(), 0, 1),
stake,
),
)
}