add rent reserve for bootstrap stakes (#6876)

* genesis investor stakes

* assert rent is sufficient for these bootstrappers
This commit is contained in:
Rob Walker
2019-11-12 12:33:40 -08:00
committed by GitHub
parent 73e3fc7c4f
commit bb00904fc8
6 changed files with 43 additions and 24 deletions

View File

@ -3,6 +3,7 @@ use solana_sdk::{
fee_calculator::FeeCalculator,
genesis_config::GenesisConfig,
pubkey::Pubkey,
rent::Rent,
signature::{Keypair, KeypairUtil},
system_program::{self, solana_system_program},
};
@ -39,10 +40,13 @@ pub fn create_genesis_config_with_leader(
bootstrap_leader_stake_lamports,
);
let rent = Rent::free();
let stake_account = stake_state::create_account(
&staking_keypair.pubkey(),
&voting_keypair.pubkey(),
&vote_account,
&rent,
bootstrap_leader_stake_lamports,
);
@ -77,6 +81,7 @@ pub fn create_genesis_config_with_leader(
accounts,
native_instruction_processors,
fee_calculator,
rent,
..GenesisConfig::default()
};

View File

@ -209,7 +209,7 @@ impl Stakes {
#[cfg(test)]
pub mod tests {
use super::*;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::{pubkey::Pubkey, rent::Rent};
use solana_stake_api::stake_state;
use solana_vote_api::vote_state::{self, VoteState, MAX_LOCKOUT_HISTORY};
@ -232,6 +232,7 @@ pub mod tests {
&stake_pubkey,
&vote_pubkey,
&vote_state::create_account(&vote_pubkey, &Pubkey::new_rand(), 0, 1),
&Rent::free(),
stake,
),
)