More AccountSharedData construction (#15844)

* one more AccountSharedData construction

* one more construct
This commit is contained in:
Jeff Washington (jwash) 2021-03-15 19:27:17 -05:00 committed by GitHub
parent 2bf46b789f
commit c09ea2c314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -1575,11 +1575,11 @@ pub mod test {
fn gen_stakes(stake_votes: &[(u64, &[u64])]) -> Vec<(Pubkey, (u64, ArcVoteAccount))> { fn gen_stakes(stake_votes: &[(u64, &[u64])]) -> Vec<(Pubkey, (u64, ArcVoteAccount))> {
let mut stakes = vec![]; let mut stakes = vec![];
for (lamports, votes) in stake_votes { for (lamports, votes) in stake_votes {
let mut account = AccountSharedData { let mut account = AccountSharedData::from(Account {
data: vec![0; VoteState::size_of()], data: vec![0; VoteState::size_of()],
lamports: *lamports, lamports: *lamports,
..AccountSharedData::default() ..Account::default()
}; });
let mut vote_state = VoteState::default(); let mut vote_state = VoteState::default();
for slot in *votes { for slot in *votes {
vote_state.process_slot_vote_unchecked(*slot); vote_state.process_slot_vote_unchecked(*slot);

View File

@ -1,14 +1,14 @@
use crate::account::AccountSharedData; use crate::account::{Account, AccountSharedData};
crate::declare_id!("NativeLoader1111111111111111111111111111111"); crate::declare_id!("NativeLoader1111111111111111111111111111111");
/// Create an executable account with the given shared object name. /// Create an executable account with the given shared object name.
pub fn create_loadable_account(name: &str, lamports: u64) -> AccountSharedData { pub fn create_loadable_account(name: &str, lamports: u64) -> AccountSharedData {
AccountSharedData { AccountSharedData::from(Account {
lamports, lamports,
owner: id(), owner: id(),
data: name.as_bytes().to_vec(), data: name.as_bytes().to_vec(),
executable: true, executable: true,
rent_epoch: 0, rent_epoch: 0,
} })
} }