refactor function to store into account after data is finished (#15710)

This commit is contained in:
Jeff Washington (jwash) 2021-03-05 11:02:35 -06:00 committed by GitHub
parent 9448540ea6
commit 13b9bb6790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 7 deletions

View File

@ -163,14 +163,13 @@ impl Accounts {
}
fn construct_instructions_account(message: &Message) -> Account {
let mut account = Account {
data: message.serialize_instructions(),
..Account::default()
};
let mut data = message.serialize_instructions();
// add room for current instruction index.
account.data.resize(account.data.len() + 2, 0);
account
data.resize(data.len() + 2, 0);
Account {
data,
..Account::default()
}
}
fn load_transaction(