From 8d5c7b7d891b5902de9e3e197655c277a402c423 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 4 Apr 2022 15:08:21 +0000 Subject: [PATCH] hides implementation details of vote-accounts from public interface (#24087) (#24102) (cherry picked from commit ef3e3dce7ab613b903cc92494eb87737a533ada6) Co-authored-by: behzad nouri --- 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 7c045906ec..5d6d8c4e45 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 {