Don't update if already an executable

This commit is contained in:
Jack May
2021-06-25 01:00:43 -07:00
committed by Trent Nelson
parent b44af11511
commit 2fbedd834f
4 changed files with 70 additions and 4 deletions

View File

@ -227,6 +227,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];
@ -1109,7 +1113,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(());