Add SystemInstruction::CreateAccount support to CPI (#11649)

This commit is contained in:
Jack May
2020-08-17 13:38:42 -07:00
committed by GitHub
parent f1ba2387d3
commit e9b610b8df
10 changed files with 243 additions and 85 deletions

View File

@ -76,7 +76,7 @@ pub const SECONDS_PER_YEAR: f64 = 365.25 * 24.0 * 60.0 * 60.0;
pub const MAX_LEADER_SCHEDULE_STAKES: Epoch = 5;
type BankStatusCache = StatusCache<Result<()>>;
#[frozen_abi(digest = "3bFpd1M1YHHKFASfjUU5L9dUkg87TKuMzwUoUebwa8Pu")]
#[frozen_abi(digest = "9qMSqhQjkhvvVL4bSoGek2VAnF9KdM9ARMXYA3G2f3iG")]
pub type BankSlotDelta = SlotDelta<Result<()>>;
type TransactionAccountRefCells = Vec<Rc<RefCell<Account>>>;
type TransactionLoaderRefCells = Vec<Vec<(Pubkey, RefCell<Account>)>>;

View File

@ -63,7 +63,7 @@ impl PreAccount {
// An account not assigned to the program cannot have its balance decrease.
if *program_id != self.owner // line coverage used to get branch coverage
&& self.lamports > post.lamports
&& self.lamports > post.lamports
{
return Err(InstructionError::ExternalAccountLamportSpend);
}
@ -127,6 +127,7 @@ impl PreAccount {
pub fn update(&mut self, account: &Account) {
self.lamports = account.lamports;
self.owner = account.owner;
if self.data.len() != account.data.len() {
// Only system account can change data size, copy with alloc
self.data = account.data.clone();