From c44d3139fd34c70da92401c71627aae5b4c26043 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Tue, 1 Oct 2019 13:05:49 -0400 Subject: [PATCH] Expose current stake accounts of a bank for use in cli tooling (#6184) (#6190) automerge --- runtime/src/bank.rs | 5 +++++ runtime/src/stakes.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 0287440569..21c2d3fafc 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -1479,6 +1479,11 @@ impl Bank { self.stakes.read().unwrap().vote_accounts().clone() } + /// current stake accounts for this bank + pub fn stake_accounts(&self) -> HashMap { + self.stakes.read().unwrap().stake_accounts().clone() + } + /// vote accounts for the specific epoch along with the stake /// attributed to each account pub fn epoch_vote_accounts(&self, epoch: Epoch) -> Option<&HashMap> { diff --git a/runtime/src/stakes.rs b/runtime/src/stakes.rs index f01193ce1f..71e72273b4 100644 --- a/runtime/src/stakes.rs +++ b/runtime/src/stakes.rs @@ -167,10 +167,15 @@ impl Stakes { } } } + pub fn vote_accounts(&self) -> &HashMap { &self.vote_accounts } + pub fn stake_accounts(&self) -> &HashMap { + &self.stake_accounts + } + pub fn rewards_pools(&self) -> impl Iterator { self.stake_accounts .iter()