turn on rent (#7368)

* turn on rent

* add rent exempt balances for bootstrap accounts

* use Rent::free() when not testing rent
This commit is contained in:
Rob Walker
2019-12-09 21:56:43 -08:00
committed by GitHub
parent ed9cf3566c
commit 39cd6dff7d
12 changed files with 89 additions and 48 deletions

View File

@ -163,14 +163,20 @@ pub fn process_create_storage_account(
"storage_account_pubkey".to_string(),
),
)?;
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
use solana_storage_program::storage_contract::STORAGE_ACCOUNT_SPACE;
let required_balance = rpc_client
.get_minimum_balance_for_rent_exemption(STORAGE_ACCOUNT_SPACE as usize)?
.max(1);
let ixs = storage_instruction::create_storage_account(
&config.keypair.pubkey(),
&account_owner,
&storage_account_pubkey,
1,
required_balance,
account_type,
);
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
let mut tx = Transaction::new_signed_instructions(
&[&config.keypair, &storage_account],
ixs,

View File

@ -243,13 +243,11 @@ pub fn process_create_vote_account(
(&config.keypair.pubkey(), "cli keypair".to_string()),
(&vote_account_pubkey, "vote_account_pubkey".to_string()),
)?;
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 required_balance = dbg!(rpc_client
.get_minimum_balance_for_rent_exemption(VoteState::size_of())?
.max(1));
let vote_init = VoteInit {
node_pubkey: *node_pubkey,
authorized_voter: authorized_voter.unwrap_or(vote_account_pubkey),
@ -260,7 +258,7 @@ pub fn process_create_vote_account(
&config.keypair.pubkey(),
&vote_account_pubkey,
&vote_init,
lamports,
required_balance,
);
let (recent_blockhash, fee_calculator) = rpc_client.get_recent_blockhash()?;
let mut tx = Transaction::new_signed_instructions(