Seperate RefCells lamports and data (#8021)

This commit is contained in:
Jack May
2020-01-29 21:15:04 -08:00
committed by GitHub
parent d5ff5f4739
commit b19f730527
5 changed files with 33 additions and 52 deletions

View File

@@ -71,10 +71,10 @@ pub trait Sysvar:
bincode::serialize_into(&mut account.data[..], self).ok()
}
fn from_account_info(account_info: &AccountInfo) -> Option<Self> {
bincode::deserialize(&account_info.m.borrow().data).ok()
bincode::deserialize(&account_info.data.borrow()).ok()
}
fn to_account_info(&self, account_info: &mut AccountInfo) -> Option<()> {
bincode::serialize_into(&mut account_info.m.borrow_mut().data[..], self).ok()
bincode::serialize_into(&mut account_info.data.borrow_mut()[..], self).ok()
}
fn from_keyed_account(keyed_account: &KeyedAccount) -> Result<Self, InstructionError> {
if !Self::check_id(keyed_account.unsigned_key()) {