account.data -> data() (#15778)
This commit is contained in:
committed by
GitHub
parent
8a3135d17b
commit
52e54e1100
@@ -7,6 +7,7 @@ use crate::{
|
||||
use chrono::prelude::{DateTime, Utc};
|
||||
use log::*;
|
||||
use solana_sdk::{
|
||||
account::ReadableAccount,
|
||||
hash::hash,
|
||||
instruction::InstructionError,
|
||||
keyed_account::{next_keyed_account, KeyedAccount},
|
||||
@@ -95,7 +96,7 @@ fn apply_account_data(
|
||||
if let Some(ref mut expr) = budget_state.pending_budget {
|
||||
let key = witness_keyed_account.unsigned_key();
|
||||
let program_id = witness_keyed_account.owner()?;
|
||||
let actual_hash = hash(&witness_keyed_account.try_account_ref()?.data);
|
||||
let actual_hash = hash(&witness_keyed_account.try_account_ref()?.data());
|
||||
expr.apply_witness(&Witness::AccountData(actual_hash, program_id), key);
|
||||
final_payment = expr.final_payment();
|
||||
}
|
||||
@@ -136,7 +137,8 @@ pub fn process_instruction(
|
||||
return Ok(());
|
||||
}
|
||||
let existing =
|
||||
BudgetState::deserialize(&contract_keyed_account.try_account_ref_mut()?.data).ok();
|
||||
BudgetState::deserialize(&contract_keyed_account.try_account_ref_mut()?.data())
|
||||
.ok();
|
||||
if Some(true) == existing.map(|x| x.initialized) {
|
||||
trace!("contract already exists");
|
||||
return Err(InstructionError::AccountAlreadyInitialized);
|
||||
@@ -151,7 +153,7 @@ pub fn process_instruction(
|
||||
let witness_keyed_account = next_keyed_account(keyed_accounts_iter)?;
|
||||
let contract_keyed_account = next_keyed_account(keyed_accounts_iter)?;
|
||||
let mut budget_state =
|
||||
BudgetState::deserialize(&contract_keyed_account.try_account_ref()?.data)?;
|
||||
BudgetState::deserialize(&contract_keyed_account.try_account_ref()?.data())?;
|
||||
if !budget_state.is_pending() {
|
||||
return Ok(()); // Nothing to do here.
|
||||
}
|
||||
@@ -177,7 +179,7 @@ pub fn process_instruction(
|
||||
let witness_keyed_account = next_keyed_account(keyed_accounts_iter)?;
|
||||
let contract_keyed_account = next_keyed_account(keyed_accounts_iter)?;
|
||||
let mut budget_state =
|
||||
BudgetState::deserialize(&contract_keyed_account.try_account_ref()?.data)?;
|
||||
BudgetState::deserialize(&contract_keyed_account.try_account_ref()?.data())?;
|
||||
if !budget_state.is_pending() {
|
||||
return Ok(()); // Nothing to do here.
|
||||
}
|
||||
@@ -202,7 +204,7 @@ pub fn process_instruction(
|
||||
let witness_keyed_account = next_keyed_account(keyed_accounts_iter)?;
|
||||
let contract_keyed_account = next_keyed_account(keyed_accounts_iter)?;
|
||||
let mut budget_state =
|
||||
BudgetState::deserialize(&contract_keyed_account.try_account_ref()?.data)?;
|
||||
BudgetState::deserialize(&contract_keyed_account.try_account_ref()?.data())?;
|
||||
if !budget_state.is_pending() {
|
||||
return Ok(()); // Nothing to do here.
|
||||
}
|
||||
@@ -528,7 +530,10 @@ mod tests {
|
||||
..AccountSharedData::default()
|
||||
};
|
||||
bank.store_account(&game_pubkey, &game_account);
|
||||
assert_eq!(bank.get_account(&game_pubkey).unwrap().data, vec![1, 2, 3]);
|
||||
assert_eq!(
|
||||
bank.get_account(&game_pubkey).unwrap().data(),
|
||||
&vec![1, 2, 3]
|
||||
);
|
||||
|
||||
let bank_client = BankClient::new(bank);
|
||||
|
||||
|
Reference in New Issue
Block a user