account.owner = X -> account.set_owner(X) (#16754)

This commit is contained in:
Jeff Washington (jwash)
2021-04-23 12:34:22 -05:00
committed by GitHub
parent 63436cc2bf
commit fb0b76c1f3
7 changed files with 23 additions and 14 deletions

View File

@ -2455,7 +2455,7 @@ mod tests {
min_program_balance,
min_programdata_balance,
);
program_account.borrow_mut().owner = Pubkey::new_unique();
program_account.borrow_mut().set_owner(Pubkey::new_unique());
let keyed_accounts = vec![
KeyedAccount::new(&programdata_address, false, &programdata_account),
KeyedAccount::new(&program_address, false, &program_account),

View File

@ -626,7 +626,7 @@ mod tests {
use super::*;
use bincode::serialize;
use solana_sdk::{
account::{self, Account, AccountSharedData},
account::{self, Account, AccountSharedData, WritableAccount},
keyed_account::KeyedAccount,
process_instruction::MockInvokeContext,
rent::Rent,
@ -1026,7 +1026,9 @@ mod tests {
let stake_account = create_default_stake_account();
let vote_address = Pubkey::default();
let mut bad_vote_account = create_default_account();
bad_vote_account.get_mut().owner = solana_vote_program::id();
bad_vote_account
.get_mut()
.set_owner(solana_vote_program::id());
let clock_address = sysvar::clock::id();
let clock_account = RefCell::new(account::create_account_shared_data_for_test(
&sysvar::clock::Clock::default(),

View File

@ -1708,8 +1708,11 @@ mod tests {
use super::*;
use crate::id;
use solana_sdk::{
account::AccountSharedData, native_token, process_instruction::MockInvokeContext,
pubkey::Pubkey, system_program,
account::{AccountSharedData, WritableAccount},
native_token,
process_instruction::MockInvokeContext,
pubkey::Pubkey,
system_program,
};
use solana_vote_program::vote_state;
use std::{cell::RefCell, iter::FromIterator};
@ -2010,7 +2013,9 @@ mod tests {
// signed but faked vote account
let faked_vote_account = vote_account.clone();
faked_vote_account.borrow_mut().owner = solana_sdk::pubkey::new_rand();
faked_vote_account
.borrow_mut()
.set_owner(solana_sdk::pubkey::new_rand());
let faked_vote_keyed_account = KeyedAccount::new(&vote_pubkey, false, &faked_vote_account);
assert_eq!(
stake_keyed_account.delegate(