Rename userdata to data (#3282)

* Rename userdata to data

Instead of saying "userdata", which is ambiguous and imprecise,
say "instruction data" or "account data".

Also, add `ProgramError::InvalidInstructionData`

Fixes #2761
This commit is contained in:
Greg Fitzgerald
2019-03-14 10:48:27 -06:00
committed by GitHub
parent de13082347
commit c1eec0290e
42 changed files with 245 additions and 254 deletions

View File

@@ -73,7 +73,7 @@ fn node_staked_accounts_at_epoch(
}
fn filter_no_delegate(account_id: &Pubkey, account: &Account) -> bool {
VoteState::deserialize(&account.userdata)
VoteState::deserialize(&account.data)
.map(|vote_state| vote_state.delegate_id != *account_id)
.unwrap_or(false)
}
@@ -91,7 +91,7 @@ fn to_vote_state(
node_staked_accounts: impl Iterator<Item = (impl Borrow<Pubkey>, u64, impl Borrow<Account>)>,
) -> impl Iterator<Item = (u64, VoteState)> {
node_staked_accounts.filter_map(|(_, stake, account)| {
VoteState::deserialize(&account.borrow().userdata)
VoteState::deserialize(&account.borrow().data)
.ok()
.map(|vote_state| (stake, vote_state))
})