Expose current stake accounts of a bank for use in cli tooling (#6184)
This commit is contained in:
@ -1485,6 +1485,11 @@ impl Bank {
|
|||||||
self.stakes.read().unwrap().vote_accounts().clone()
|
self.stakes.read().unwrap().vote_accounts().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// current stake accounts for this bank
|
||||||
|
pub fn stake_accounts(&self) -> HashMap<Pubkey, Account> {
|
||||||
|
self.stakes.read().unwrap().stake_accounts().clone()
|
||||||
|
}
|
||||||
|
|
||||||
/// vote accounts for the specific epoch along with the stake
|
/// vote accounts for the specific epoch along with the stake
|
||||||
/// attributed to each account
|
/// attributed to each account
|
||||||
pub fn epoch_vote_accounts(&self, epoch: Epoch) -> Option<&HashMap<Pubkey, (u64, Account)>> {
|
pub fn epoch_vote_accounts(&self, epoch: Epoch) -> Option<&HashMap<Pubkey, (u64, Account)>> {
|
||||||
|
@ -167,10 +167,15 @@ impl Stakes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vote_accounts(&self) -> &HashMap<Pubkey, (u64, Account)> {
|
pub fn vote_accounts(&self) -> &HashMap<Pubkey, (u64, Account)> {
|
||||||
&self.vote_accounts
|
&self.vote_accounts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn stake_accounts(&self) -> &HashMap<Pubkey, Account> {
|
||||||
|
&self.stake_accounts
|
||||||
|
}
|
||||||
|
|
||||||
pub fn rewards_pools(&self) -> impl Iterator<Item = (&Pubkey, &Account)> {
|
pub fn rewards_pools(&self) -> impl Iterator<Item = (&Pubkey, &Account)> {
|
||||||
self.stake_accounts
|
self.stake_accounts
|
||||||
.iter()
|
.iter()
|
||||||
|
Reference in New Issue
Block a user