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

@ -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();