Don't update if already an executable

(cherry picked from commit 2fbedd834f)
This commit is contained in:
Jack May
2021-06-25 01:00:43 -07:00
committed by Trent Nelson
parent 41d50adbf3
commit 6a0a03415c
4 changed files with 70 additions and 4 deletions

View File

@@ -220,6 +220,10 @@ impl PreAccount {
self.account.borrow().lamports()
}
pub fn executable(&self) -> bool {
self.account.borrow().executable()
}
pub fn is_zeroed(buf: &[u8]) -> bool {
const ZEROS_LEN: usize = 1024;
static ZEROS: [u8; ZEROS_LEN] = [0; ZEROS_LEN];
@@ -1102,7 +1106,7 @@ impl MessageProcessor {
})?;
pre_sum += u128::from(pre_account.lamports());
post_sum += u128::from(account.lamports());
if is_writable && !account.executable() {
if is_writable && !pre_account.executable() {
pre_account.update(&account);
}
return Ok(());