@@ -70,17 +70,17 @@ pub trait Sysvar:
|
||||
fn to_account(&self, account: &mut Account) -> Option<()> {
|
||||
bincode::serialize_into(&mut account.data[..], self).ok()
|
||||
}
|
||||
fn from_account_info(account: &AccountInfo) -> Option<Self> {
|
||||
bincode::deserialize(&account.data).ok()
|
||||
fn from_account_info(account_info: &AccountInfo) -> Option<Self> {
|
||||
bincode::deserialize(&account_info.data).ok()
|
||||
}
|
||||
fn to_account_info(&self, account: &mut AccountInfo) -> Option<()> {
|
||||
bincode::serialize_into(&mut account.data[..], self).ok()
|
||||
fn to_account_info(&self, account_info: &mut AccountInfo) -> Option<()> {
|
||||
bincode::serialize_into(&mut account_info.data[..], self).ok()
|
||||
}
|
||||
fn from_keyed_account(account: &KeyedAccount) -> Result<Self, InstructionError> {
|
||||
if !Self::check_id(account.unsigned_key()) {
|
||||
fn from_keyed_account(keyed_account: &KeyedAccount) -> Result<Self, InstructionError> {
|
||||
if !Self::check_id(keyed_account.unsigned_key()) {
|
||||
return Err(InstructionError::InvalidArgument);
|
||||
}
|
||||
Self::from_account(account.account).ok_or(InstructionError::InvalidArgument)
|
||||
Self::from_account(keyed_account.account).ok_or(InstructionError::InvalidArgument)
|
||||
}
|
||||
fn create_account(&self, lamports: u64) -> Account {
|
||||
let data_len = Self::size_of().max(bincode::serialized_size(self).unwrap() as usize);
|
||||
|
Reference in New Issue
Block a user