* 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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user