Clean up demote program write lock feature (#21949)

* Clean up demote program write lock feature

* fix test
This commit is contained in:
Justin Starry
2021-12-16 17:27:22 -05:00
committed by GitHub
parent a5769c029f
commit 6ff0be6a82
19 changed files with 98 additions and 204 deletions

View File

@ -410,7 +410,7 @@ pub fn uses_durable_nonce(tx: &Transaction) -> Option<&CompiledInstruction> {
// Nonce account is writable
&& matches!(
instruction.accounts.get(0),
Some(index) if message.is_writable(*index as usize, true)
Some(index) if message.is_writable(*index as usize)
)
})
}

View File

@ -140,7 +140,7 @@ impl SanitizedTransaction {
}
/// Return the list of accounts that must be locked during processing this transaction.
pub fn get_account_locks(&self, demote_program_write_locks: bool) -> TransactionAccountLocks {
pub fn get_account_locks(&self) -> TransactionAccountLocks {
let message = &self.message;
let num_readonly_accounts = message.num_readonly_accounts();
let num_writable_accounts = message
@ -153,7 +153,7 @@ impl SanitizedTransaction {
};
for (i, key) in message.account_keys_iter().enumerate() {
if message.is_writable(i, demote_program_write_locks) {
if message.is_writable(i) {
account_locks.writable.push(key);
} else {
account_locks.readonly.push(key);
@ -183,7 +183,7 @@ impl SanitizedTransaction {
.and_then(|ix| {
ix.accounts.get(0).and_then(|idx| {
let idx = *idx as usize;
if nonce_must_be_writable && !self.message.is_writable(idx, true) {
if nonce_must_be_writable && !self.message.is_writable(idx) {
None
} else {
self.message.get_account_key(idx)