Remove get_stake placeholder
This commit is contained in:
parent
6aa80e431d
commit
aba9df8457
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue