Account for rent (#7626)

automerge
This commit is contained in:
Michael Vines
2019-12-24 19:01:21 -07:00
committed by Grimes
parent 727be309b2
commit 89f5f336af
2 changed files with 11 additions and 3 deletions

View File

@ -7,7 +7,7 @@ use chrono::{Local, TimeZone};
use console::{style, Emoji}; use console::{style, Emoji};
use indicatif::{ProgressBar, ProgressStyle}; use indicatif::{ProgressBar, ProgressStyle};
use solana_client::rpc_client::RpcClient; use solana_client::rpc_client::RpcClient;
use solana_config_program::{config_instruction, get_config_data}; use solana_config_program::{config_instruction, get_config_data, ConfigState};
use solana_sdk::{ use solana_sdk::{
hash::{Hash, Hasher}, hash::{Hash, Hasher},
message::Message, message::Message,
@ -202,10 +202,13 @@ fn new_update_manifest(
{ {
let (recent_blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?; let (recent_blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?;
let lamports = rpc_client
.get_minimum_balance_for_rent_exemption(SignedUpdateManifest::max_space() as usize)?;
let new_account = config_instruction::create_account::<SignedUpdateManifest>( let new_account = config_instruction::create_account::<SignedUpdateManifest>(
&from_keypair.pubkey(), &from_keypair.pubkey(),
&update_manifest_keypair.pubkey(), &update_manifest_keypair.pubkey(),
1, // lamports lamports,
vec![], // additional keys vec![], // additional keys
); );
let mut transaction = Transaction::new_unsigned_instructions(new_account); let mut transaction = Transaction::new_unsigned_instructions(new_account);

View File

@ -18,7 +18,12 @@ pub fn process_instruction(
let config_keyed_account = &mut next_keyed_account(keyed_accounts_iter)?; let config_keyed_account = &mut next_keyed_account(keyed_accounts_iter)?;
let current_data: ConfigKeys = let current_data: ConfigKeys =
deserialize(&config_keyed_account.account.data).map_err(|err| { deserialize(&config_keyed_account.account.data).map_err(|err| {
error!("Invalid data in account[0]: {:?} {:?}", data, err); error!(
"Unable to deserialize account[0]: {:?} (len={}): {:?}",
config_keyed_account.account.data,
config_keyed_account.account.data.len(),
err
);
InstructionError::InvalidAccountData InstructionError::InvalidAccountData
})?; })?;
let current_signer_keys: Vec<Pubkey> = current_data let current_signer_keys: Vec<Pubkey> = current_data