Remove get_stake placeholder

This commit is contained in:
Greg Fitzgerald 2019-01-23 15:25:54 -08:00 committed by Grimes
parent 6aa80e431d
commit aba9df8457
5 changed files with 4 additions and 10 deletions

View File

@ -885,12 +885,6 @@ impl Bank {
.unwrap_or(0)
}
/// TODO: Need to implement a real staking program to hold node stake.
/// Right now this just gets the account balances. See github issue #1655.
pub fn get_stake(&self, pubkey: &Pubkey) -> u64 {
self.get_balance(pubkey)
}
pub fn get_account(&self, pubkey: &Pubkey) -> Option<Account> {
self.accounts.load_slow(pubkey)
}

View File

@ -321,7 +321,7 @@ impl ClusterInfo {
fn sort_by_stake(peers: &[NodeInfo], bank: &Arc<Bank>) -> Vec<(u64, NodeInfo)> {
let mut peers_with_stakes: Vec<_> = peers
.iter()
.map(|c| (bank.get_stake(&c.id), c.clone()))
.map(|c| (bank.get_balance(&c.id), c.clone()))
.collect();
peers_with_stakes.sort_unstable();
peers_with_stakes

View File

@ -60,7 +60,7 @@ impl ComputeLeaderConfirmationService {
let mut ticks_and_stakes: Vec<(u64, u64)> = vote_states
.iter()
.filter_map(|vote_state| {
let validator_stake = bank.get_stake(&vote_state.node_id);
let validator_stake = bank.get_balance(&vote_state.node_id);
total_stake += validator_stake;
// Filter out any validators that don't have at least one vote
// by returning None

View File

@ -419,7 +419,7 @@ impl LeaderScheduler {
{
let mut active_accounts: Vec<(&'a Pubkey, u64)> = active
.filter_map(|pk| {
let stake = bank.get_stake(pk);
let stake = bank.get_balance(pk);
if stake > 0 {
Some((pk, stake as u64))
} else {

View File

@ -62,7 +62,7 @@ fn retransmit(
//find my index (my ix is the same as the first node with smaller stake)
let my_index = peers
.iter()
.position(|ci| bank.get_stake(&ci.id) <= bank.get_stake(&my_id));
.position(|ci| bank.get_balance(&ci.id) <= bank.get_balance(&my_id));
//find my layer
let locality = ClusterInfo::localize(
&layer_indices,