hides implementation details of vote-accounts from public interface (#24087)

This commit is contained in:
behzad nouri 2022-04-04 13:20:26 +00:00 committed by GitHub
parent 04158ee455
commit ef3e3dce7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 19 deletions

View File

@ -52,12 +52,8 @@ pub struct VoteAccounts {
}
impl VoteAccount {
pub fn account(&self) -> &Account {
&self.0.account
}
pub(crate) fn lamports(&self) -> u64 {
self.account().lamports()
self.0.account.lamports()
}
pub fn vote_state(&self) -> RwLockReadGuard<Result<VoteState, InstructionError>> {
@ -69,7 +65,7 @@ impl VoteAccount {
inner.vote_state.read().unwrap()
}
pub fn is_deserialized(&self) -> bool {
pub(crate) fn is_deserialized(&self) -> bool {
self.0.vote_state_once.is_completed()
}
@ -196,7 +192,7 @@ impl<'de> Deserialize<'de> for VoteAccount {
impl From<AccountSharedData> for VoteAccount {
fn from(account: AccountSharedData) -> Self {
Self(Arc::new(VoteAccountInner::from(account)))
Self::from(Account::from(account))
}
}
@ -206,18 +202,6 @@ impl From<Account> for VoteAccount {
}
}
impl AsRef<VoteAccountInner> for VoteAccount {
fn as_ref(&self) -> &VoteAccountInner {
&self.0
}
}
impl From<AccountSharedData> for VoteAccountInner {
fn from(account: AccountSharedData) -> Self {
Self::from(Account::from(account))
}
}
impl From<Account> for VoteAccountInner {
fn from(account: Account) -> Self {
Self {