Create vote account with at least 1 lamport (#6188)

This commit is contained in:
Tyera Eulberg 2019-09-30 17:07:44 -06:00 committed by GitHub
parent 520f7c3e18
commit fee97236bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -78,11 +78,16 @@ pub fn process_create_vote_account(
)?;
let required_balance =
rpc_client.get_minimum_balance_for_rent_exemption(VoteState::size_of())?;
let lamports = if required_balance > 0 {
required_balance
} else {
1
};
let ixs = vote_instruction::create_account(
&config.keypair.pubkey(),
vote_account_pubkey,
vote_init,
required_balance,
lamports,
);
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
let mut tx = Transaction::new_signed_instructions(&[&config.keypair], ixs, recent_blockhash);