From ef3e3dce7ab613b903cc92494eb87737a533ada6 Mon Sep 17 00:00:00 2001 From: behzad nouri Date: Mon, 4 Apr 2022 13:20:26 +0000 Subject: [PATCH] hides implementation details of vote-accounts from public interface (#24087) --- runtime/src/vote_account.rs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/runtime/src/vote_account.rs b/runtime/src/vote_account.rs index e57d6be17b..75750b2fd2 100644 --- a/runtime/src/vote_account.rs +++ b/runtime/src/vote_account.rs @@ -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> { @@ -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 for VoteAccount { fn from(account: AccountSharedData) -> Self { - Self(Arc::new(VoteAccountInner::from(account))) + Self::from(Account::from(account)) } } @@ -206,18 +202,6 @@ impl From for VoteAccount { } } -impl AsRef for VoteAccount { - fn as_ref(&self) -> &VoteAccountInner { - &self.0 - } -} - -impl From for VoteAccountInner { - fn from(account: AccountSharedData) -> Self { - Self::from(Account::from(account)) - } -} - impl From for VoteAccountInner { fn from(account: Account) -> Self { Self {