hides implementation details of vote-accounts from public interface (#24087)
This commit is contained in:
@ -52,12 +52,8 @@ pub struct VoteAccounts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VoteAccount {
|
impl VoteAccount {
|
||||||
pub fn account(&self) -> &Account {
|
|
||||||
&self.0.account
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn lamports(&self) -> u64 {
|
pub(crate) fn lamports(&self) -> u64 {
|
||||||
self.account().lamports()
|
self.0.account.lamports()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vote_state(&self) -> RwLockReadGuard<Result<VoteState, InstructionError>> {
|
pub fn vote_state(&self) -> RwLockReadGuard<Result<VoteState, InstructionError>> {
|
||||||
@ -69,7 +65,7 @@ impl VoteAccount {
|
|||||||
inner.vote_state.read().unwrap()
|
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()
|
self.0.vote_state_once.is_completed()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +192,7 @@ impl<'de> Deserialize<'de> for VoteAccount {
|
|||||||
|
|
||||||
impl From<AccountSharedData> for VoteAccount {
|
impl From<AccountSharedData> for VoteAccount {
|
||||||
fn from(account: AccountSharedData) -> Self {
|
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 {
|
impl From<Account> for VoteAccountInner {
|
||||||
fn from(account: Account) -> Self {
|
fn from(account: Account) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
Reference in New Issue
Block a user