account.owner = X -> account.set_owner(X) (#16754)
This commit is contained in:
committed by
GitHub
parent
63436cc2bf
commit
fb0b76c1f3
@ -6687,10 +6687,10 @@ pub mod tests {
|
||||
account_data_with_mint[..PUBKEY_BYTES].clone_from_slice(&(mint_key.to_bytes()));
|
||||
|
||||
let mut normal_account = AccountSharedData::new(1, 0, AccountSharedData::default().owner());
|
||||
normal_account.owner = inline_spl_token_v2_0::id();
|
||||
normal_account.set_owner(inline_spl_token_v2_0::id());
|
||||
normal_account.set_data(account_data_with_mint.clone());
|
||||
let mut zero_account = AccountSharedData::new(0, 0, AccountSharedData::default().owner());
|
||||
zero_account.owner = inline_spl_token_v2_0::id();
|
||||
zero_account.set_owner(inline_spl_token_v2_0::id());
|
||||
zero_account.set_data(account_data_with_mint);
|
||||
|
||||
//store an account
|
||||
|
@ -12121,7 +12121,7 @@ pub(crate) mod tests {
|
||||
// freely modified with malicious data
|
||||
let bogus_vote_program = Pubkey::new_unique();
|
||||
vote_account.lamports = original_lamports;
|
||||
vote_account.owner = bogus_vote_program;
|
||||
vote_account.set_owner(bogus_vote_program);
|
||||
bank.store_account(
|
||||
&validator_vote_keypairs0.vote_keypair.pubkey(),
|
||||
&vote_account,
|
||||
@ -12135,7 +12135,7 @@ pub(crate) mod tests {
|
||||
let mut stake_account = bank
|
||||
.get_account(&validator_vote_keypairs1.stake_keypair.pubkey())
|
||||
.unwrap_or_default();
|
||||
stake_account.owner = bogus_stake_program;
|
||||
stake_account.set_owner(bogus_stake_program);
|
||||
bank.store_account(
|
||||
&validator_vote_keypairs1.stake_keypair.pubkey(),
|
||||
&stake_account,
|
||||
|
@ -916,7 +916,9 @@ impl MessageProcessor {
|
||||
return Err(InstructionError::InvalidRealloc);
|
||||
}
|
||||
dst_keyed_account.try_account_ref_mut()?.lamports = src_keyed_account.lamports;
|
||||
dst_keyed_account.try_account_ref_mut()?.owner = src_keyed_account.owner;
|
||||
dst_keyed_account
|
||||
.try_account_ref_mut()?
|
||||
.set_owner(src_keyed_account.owner);
|
||||
dst_keyed_account
|
||||
.try_account_ref_mut()?
|
||||
.set_data(src_keyed_account.data().to_vec());
|
||||
@ -1463,7 +1465,7 @@ mod tests {
|
||||
self
|
||||
}
|
||||
pub fn owner(mut self, post: &Pubkey) -> Self {
|
||||
self.post.owner = *post;
|
||||
self.post.set_owner(*post);
|
||||
self
|
||||
}
|
||||
pub fn data(mut self, pre: Vec<u8>, post: Vec<u8>) -> Self {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use log::*;
|
||||
use solana_sdk::{
|
||||
account::{AccountSharedData, ReadableAccount},
|
||||
account::{AccountSharedData, ReadableAccount, WritableAccount},
|
||||
account_utils::StateMut,
|
||||
ic_msg,
|
||||
instruction::InstructionError,
|
||||
@ -126,7 +126,7 @@ fn assign(
|
||||
return Err(SystemError::InvalidProgramId.into());
|
||||
}
|
||||
|
||||
account.owner = *owner;
|
||||
account.set_owner(*owner);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user