BorrowedAccount: reserve() doesn't need to check for can_data_be_changed() (#32642)
reserve() only changes the capacity of the vector that holds the account data, it doesn't modify the account in any way
This commit is contained in:
parent
de02601d73
commit
029f7b1d56
|
@ -964,7 +964,10 @@ impl<'a> BorrowedAccount<'a> {
|
||||||
/// in the given account. Does nothing if capacity is already sufficient.
|
/// in the given account. Does nothing if capacity is already sufficient.
|
||||||
#[cfg(not(target_os = "solana"))]
|
#[cfg(not(target_os = "solana"))]
|
||||||
pub fn reserve(&mut self, additional: usize) -> Result<(), InstructionError> {
|
pub fn reserve(&mut self, additional: usize) -> Result<(), InstructionError> {
|
||||||
self.can_data_be_changed()?;
|
// Note that we don't need to call can_data_be_changed() here nor
|
||||||
|
// touch() the account. reserve() only changes the capacity of the
|
||||||
|
// memory that holds the account but it doesn't actually change content
|
||||||
|
// nor length of the account.
|
||||||
self.make_data_mut();
|
self.make_data_mut();
|
||||||
self.account.reserve(additional);
|
self.account.reserve(additional);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue