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

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

(cherry picked from commit e9b610b8df)

# Conflicts:
#	programs/bpf_loader/src/syscalls.rs
#	runtime/src/bank.rs
#	sdk/src/instruction.rs

* resolve conflicts

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2020-08-25 19:52:27 +00:00
committed by GitHub
parent d5d1a344c3
commit 39eeb0142e
8 changed files with 238 additions and 84 deletions

View File

@@ -69,7 +69,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);
}
@@ -133,6 +133,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();