No longer allow create-account to add funds to an existing account (#10192)

automerge
This commit is contained in:
Greg Fitzgerald
2020-05-22 17:39:01 -06:00
committed by GitHub
parent 2d3a906d55
commit 36a36d1c83
3 changed files with 105 additions and 8 deletions

View File

@ -208,8 +208,13 @@ pub fn split(
split_stake_pubkey: &Pubkey,
) -> Vec<Instruction> {
vec![
system_instruction::allocate(split_stake_pubkey, std::mem::size_of::<StakeState>() as u64),
system_instruction::assign(split_stake_pubkey, &id()),
system_instruction::create_account(
authorized_pubkey, // Sending 0, so any signer will suffice
split_stake_pubkey,
0,
std::mem::size_of::<StakeState>() as u64,
&id(),
),
_split(
stake_pubkey,
authorized_pubkey,
@ -228,10 +233,12 @@ pub fn split_with_seed(
seed: &str, // seed
) -> Vec<Instruction> {
vec![
system_instruction::allocate_with_seed(
system_instruction::create_account_with_seed(
authorized_pubkey, // Sending 0, so any signer will suffice
split_stake_pubkey,
base,
seed,
0,
std::mem::size_of::<StakeState>() as u64,
&id(),
),
@ -489,7 +496,7 @@ mod tests {
&Pubkey::default(),
100,
&Pubkey::default()
)[2]
)[1]
),
Err(InstructionError::InvalidAccountData),
);