Add storage space constant (#4366)

automerge
This commit is contained in:
Sagar Dhawan
2019-05-21 11:07:13 -07:00
committed by Grimes
parent f877fb8c8f
commit c9ba9e4eb7
6 changed files with 27 additions and 31 deletions

View File

@ -24,7 +24,6 @@ use solana_sdk::genesis_block::GenesisBlock;
use solana_sdk::hash::{Hash, Hasher};
use solana_sdk::message::Message;
use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
use solana_sdk::system_transaction;
use solana_sdk::timing::timestamp;
use solana_sdk::transaction::Transaction;
use solana_sdk::transport::TransportError;
@ -415,14 +414,13 @@ impl Replicator {
let bal = client.poll_get_balance(&storage_keypair.pubkey());
if bal.is_err() || bal.unwrap() == 0 {
let (blockhash, _fee_calculator) = client.get_recent_blockhash().expect("blockhash");
let tx = system_transaction::create_account(
keypair,
let ix = vec![storage_instruction::create_account(
&keypair.pubkey(),
&storage_keypair.pubkey(),
blockhash,
1,
1024 * 4, // TODO the account space needs to be well defined somewhere
&solana_storage_api::id(),
);
)];
let tx = Transaction::new_signed_instructions(&[keypair], ix, blockhash);
let signature = client.async_send_transaction(tx)?;
client
.poll_for_signature(&signature)

View File

@ -17,7 +17,6 @@ use solana_sdk::instruction::Instruction;
use solana_sdk::message::Message;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
use solana_sdk::system_instruction;
use solana_sdk::transaction::Transaction;
use solana_storage_api::storage_instruction::StorageInstruction;
use solana_storage_api::{get_segment_from_slot, storage_instruction};
@ -245,12 +244,10 @@ impl StorageStage {
.get_account(&storage_keypair.pubkey())
.is_none()
{
let create_instruction = system_instruction::create_account(
let create_instruction = storage_instruction::create_account(
&keypair.pubkey(),
&storage_keypair.pubkey(),
1,
1024 * 4, // TODO the account space needs to be well defined somewhere
&solana_storage_api::id(),
);
instructions.push(create_instruction);
info!("storage account requested");